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=0.7 required=5.0 tests=BAYES_00,MSGID_RANDY autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,148ece082805bf8f X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2000-12-13 17:50:17 PST Path: supernews.google.com!sn-xit-02!supernews.com!newsfeed.mesh.ad.jp!portc03.blue.aol.com!newsfeed.mathworks.com!news.maxwell.syr.edu!nntp2.deja.com!nnrp1.deja.com!not-for-mail From: Robert Dewar Newsgroups: comp.lang.ada Subject: Re: GNAT bug with respect to an Implementation Advise Date: Thu, 14 Dec 2000 01:40:13 GMT Organization: Deja.com Message-ID: <9198ds$n3o$1@nnrp1.deja.com> References: NNTP-Posting-Host: 205.232.38.41 X-Article-Creation-Date: Thu Dec 14 01:40:13 2000 GMT X-Http-User-Agent: Mozilla/4.61 [en] (OS/2; U) X-Http-Proxy: 1.0 x69.deja.com:80 (Squid/1.1.22) for client 205.232.38.41 X-MyDeja-Info: XMYDJUIDrobert_dewar Xref: supernews.google.com comp.lang.ada:3110 Date: 2000-12-14T01:40:13+00:00 List-Id: In article , "Jeff Creem" wrote: > The LRM has an implementation advice that says: > > 13.13.2(17): Stream Oriented Attributes The RM is actually a little unclear here, since it is not clear how subtypes should be treated when they have different in memory sizes from the base type. For example, suppose we write: type x is range 1 .. 1000; for x'size use 16; subtype y is x range 1 .. 10; xx : x; yy : y; Now we can imagine several implementations, all valid from the RM: 1. xx, yy both take 32 bits in memory 2. xx, yy both take 16 bits 3. xx takes 16 bits, yy takes 8 bits Now you can imagine these three implementations trying to follow the RM generating three different streams, which seems unfortunately unportable, given that the IA is presumably trying to create uniformity. What we did in GNAT was to decide that "normal in memory representation" meant the space that the base type would take, regardless of the space actually occupied by individual subtype variables. But at least one other implementation took approach 3. So the RM is not the issue here, both these implementations are following a reasonable interpretation of the RM requirement. What's wrong is the RM requirement! What the AI did here was to normalize the stream requirement to be the space that *would* be minimally required to store the first subtype. Note that in some implementations this might well not correspond to ANY actual stored variable, and thus the AI requirement might actually clearly violate the IA. Nevertheless this seemed a reasonable way of making things compatible, and we will introduce an option in GNAT to conform to the AI (it has to be an option, because otherwise we have a nasty incompatibility with the previous valid implementation). Of course if you do not use a size clause, the GNAT implementation is conforming to the IA (whereas the approach of different sizes for different subtypes is always "wrong"). Robert Dewar Sent via Deja.com http://www.deja.com/