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,aa7b0448abeecbba X-Google-Attributes: gid103376,public From: kst@thomsoft.com (Keith Thompson) Subject: Re: How to print Task_ID type? (GNAT SunOS) Date: 1996/04/06 Message-ID: #1/1 X-Deja-AN: 146050143 sender: news@thomsoft.com (USENET News Admin @flash) x-nntp-posting-host: pulsar references: <316308F0.6375@ee.ubc.ca> <31642F61.1D2B@ee.ubc.ca> organization: Thomson Software Products, San Diego, CA, USA newsgroups: comp.lang.ada originator: kst@pulsar Date: 1996-04-06T00:00:00+00:00 List-Id: In dewar@cs.nyu.edu (Robert Dewar) writes: [...] > The method is fine, the test for null is appropriate (I missed that > in my message before!) The caution is probably unnecessary, I think > you will find that even in implementations where descriptors etc > are used, that 'Address is likely to point to the data. Remember > that X.all is the value of the type, and 'Address will normally > point to this data. One would think so, but I just tried an experiment with one particular Ada 83 compiler. For an object P declared as an access to unconstrained String, P and P.all'Address have the same value (when Uncheckedly_Converted to an integer type), but P(P'First)'Address has a different value. It turns out that P points to a descriptor, and P(P'First)'Address is the address of the first character of the string itself. This should probably (almost certainly) be considered a bug in that compiler's implementation of P.all'Address, which should be the address of the string, not of the descriptor. > You could make doubly sure in the only case > where there even conceivably could be trouble (arrays), by using > > x.all(x'first)'address Which will raise Constraint_Error if X.all is a null array. For what I suspect is the most common application for this kind of thing, interfacing to C, this shouldn't matter, since C doesn't have null arrays (though future versions of the C standard might). (Incidentally, the ".all" in the above expression is optional.) > but at this stage, this is getting a bit junky, so even though it is > a bit more complexity, it is probably ceaner to instantiate > address_to_access conversions to get the adress value. How does Address_To_Access_Conversions help in this case? It only lets you convert between System.Addess and an access type declared in Address_To_Access_Conversions; it doesn't provide operations on arbitrary user-declared access types. -- Keith Thompson (The_Other_Keith) kst@thomsoft.com TeleSoft^H^H^H^H^H^H^H^H Alsys^H^H^H^H^H Thomson Software Products 10251 Vista Sorrento Parkway, Suite 300, San Diego, CA, USA, 92121-2718 This sig uses the word "Exon" in violation of the Communications Decency Act.