From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,53e53000d1e9b814 X-Google-Attributes: gid103376,public From: dewar@merv.cs.nyu.edu (Robert Dewar) Subject: Re: [Q] : Unchecked conversion Date: 1996/11/09 Message-ID: #1/1 X-Deja-AN: 195564261 references: <01bbce46$0f818680$829d6482@joy.ericsson.se> organization: New York University newsgroups: comp.lang.ada Date: 1996-11-09T00:00:00+00:00 List-Id: iJonas Nugren asks "1) Is this a Gnat(3.04a) imposed limitation on Unchecked_Conversion or is my code illegal irregardless of compiler? " asking about a case of unchecked conversion between uncosntrained array types. In the current version of GNAT, we have relaxed this restrictoin somewhat and allow the source to be an unconstrained array, but not the target. Letting the target be an unconstrained array is pretty bogus, where would the bounds come from in the general case, yes, I guess you could allow it in limited cases but it seems dubious (note that the DEC Ada 83 compiler has exactly the same set of restrictions -- that was the inspiration for relaxing the GNAt rules). You can easily do what you want however, by instantiating UC locally for a constrained subtype with appropriate bounds. That's really a preferable way of doing things in any case. Or you can do UC between pointers to such unconstrained types (that's probably all the UC between the arrays does anyway, and that way you avoid making a copy of the array, converting pointers just gives you a different view of the data, and is usually preferable).