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 X-Google-Thread: 103376,4b89102f705d4611 X-Google-Attributes: gid103376,public From: Nicolas Brunot Subject: Re: The Incredible Shrinking Type Date: 2000/11/07 Message-ID: <3A0816D4.E980EAFB@cadwin.com>#1/1 X-Deja-AN: 690805723 Content-Transfer-Encoding: 8bit References: <3A0703F5.9333AE56@earthlink.net> <8u7gte$7ie$1@nnrp1.deja.com> X-Accept-Language: fr Content-Type: text/plain; charset=iso-8859-1 X-Complaints-To: abuse@proxad.net X-Trace: nnrp2.proxad.net 973608707 212.27.51.203 (Tue, 07 Nov 2000 15:51:47 CET) Organization: Guest of ProXad - France MIME-Version: 1.0 NNTP-Posting-Date: Tue, 07 Nov 2000 15:51:47 CET Newsgroups: comp.lang.ada Date: 2000-11-07T00:00:00+00:00 List-Id: I don't see any confusion here between the size of a type with the size of objects of the type, since I read Shrinking the type seems in any case quite a dangerous thing to do, since what is done here is quite common when you want to map an Ada record type to a C type, without using all the components of the C type. There will certainly be execution crash if C code try to access the bits you don't use in Ada. More than that, reading Gnat documentation, you are more likely to expect a bigger size for the object, which is not big deal, than a shrinking, which is everything but safe, and certainly not improve portability required by the RM. Robert Dewar a �crit : > In article <3A0703F5.9333AE56@earthlink.net>, > "Marc A. Criley" wrote: > > > However, when passing an instance of this type as a parameter > to a procedure and > > extracting its 'Size, the result is 64. What happened to the > rest of the bits? > > Granted, they were unused, but still... Where is this > behavior addressed by the > > language (if it is), or is it a freedom granted to compiler > implementor's? > > You are making the common mistake of confusing the size of > a type with the size of objects of the type. Specifying the > size of a type only affects packing and unchecked conversion > in Ada 95 semantics. It does not determine the size of > objects of the type, and there is no requirement that the > size of all objects of the type be the same. > > So the real issue here is what you have read in the RM that > implies that the above behavior is expected or not expected. > Actually asking for more than 64 bits for a scalar type is > a bit peculiar anyway (and way out of the portable behavior > required by the RM). > > Sent via Deja.com http://www.deja.com/ > Before you buy.