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,cef1e23795181e0c X-Google-Attributes: gid103376,public From: dale@cs.rmit.edu.au (Dale Stanbrough) Subject: Re: Alternate to Unchecked_Conversion - Portable? Date: 1999/02/26 Message-ID: #1/1 X-Deja-AN: 448485898 References: <36d05e39.0@news.pacifier.com> <36d2638e.6427631@nntp.concentric.net> <7avpi0$jke$1@nnrp1.dejanews.com> <36d3bf1f.1891152@nntp.concentric.net> <7b2leu$ad$1@nnrp1.dejanews.com> <36d51061.1537646@nntp.concentric.net> <7b3h1u$mv5$1@nnrp1.dejanews.com> X-Complaints-To: abuse@cs.rmit.edu.au X-Trace: emu.cs.rmit.edu.au 919983405 20936 144.205.16.58 (25 Feb 1999 22:56:45 GMT) Organization: Department of Computer Science, RMIT NNTP-Posting-Date: 25 Feb 1999 22:56:45 GMT Newsgroups: comp.lang.ada Date: 1999-02-25T22:56:45+00:00 List-Id: > The only meaningful way to do that is to follow the > prescription I gave. Trying to convert constrained to > unconstrained pointers is always meaningless (and indeed > will typically not even come close to "working" in many > compilers) > > > It can often be made to work ... > > Famous last words. What this means is that by tweaking > and fiddling, you can write something that appears to > work at least in the limited cases in which you try it > out on the particular version of the particular compiler > you are using. Why can't we have a routine (it would no doubt have been best in System.Address_To_Access_Conversions) that allows for the creation of unconstrained pointers... e.g. pointer := to_unconstrained_pointer (some_address, low_bound, upper_bound); This way we could recover some of the Ada semantics back into our arrays when interfacing with other langauges (esp. as we often know the dimensions of the arrays we are dealing with). Perhaps... System.Address_To_Access_Conversions.Array_Access or System.Address_To_Array_Access_Conversions ? For example if you have a pointer to a C string, you could use the above as... X : String_Access := To_Unconstrained_Pointer ( C_String'address, 1, strlen (C_String)); Certainly this could only be reliably provided by the compiler vendors, for the reasons already stated. Dale