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: robert_dewar@my-dejanews.com Subject: Re: Alternate to Unchecked_Conversion - Portable? Date: 1999/02/25 Message-ID: <7b3h1u$mv5$1@nnrp1.dejanews.com>#1/1 X-Deja-AN: 448278979 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> X-Http-Proxy: 1.0 x2.dejanews.com:80 (Squid/1.1.22) for client 205.232.38.14 Organization: Deja News - The Leader in Internet Discussion X-Article-Creation-Date: Thu Feb 25 12:52:16 1999 GMT Newsgroups: comp.lang.ada X-Http-User-Agent: Mozilla/4.04 [en] (OS/2; I) Date: 1999-02-25T00:00:00+00:00 List-Id: In article <36d51061.1537646@nntp.concentric.net>, cjrgreen@concentric.net (Christopher Green) wrote: > Not quite meaningless; if you can construct the compiler- > dependent dope associated with the access value, it > most definitely works. The result is quite nonportable, > so it is appropriate only where the effort is worthwhile. 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. You need to write code which you *know* will work because you have a good foundation for reasoning about it and your reasoning indicates that it is correct, not simply that it works. The simplest case of course is that you write strictly portable RM guaranteed code that has no implementation dependencies. If you wander into implementation dependent areas, you need to have a firm basis for your analysis that your code is correct. For example, your code may depend on the fact that the representation of a C pointer and the representation of an Ada pointer (other than pointer to unconstrained array) are identical. This is a quite reasonable assumption, followed by virtually every compiler, and is a well defined assumption that can be verified if you move from one compiler to another. But writing erroneous junk that happens to work on one compiler, or depending on some fiddling that is dependent on the very specific layout, e.g. of array bounds in the unconstrained pointer case, does NOT qualify. -----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own