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,ffdd4d59cbfb4caf X-Google-Attributes: gid103376,public From: bobduff@world.std.com (Robert A Duff) Subject: Re: Ada 95 Numerics questions for the experts Date: 1997/09/02 Message-ID: #1/1 X-Deja-AN: 269457266 References: Organization: The World Public Access UNIX, Brookline, MA Newsgroups: comp.lang.ada Date: 1997-09-02T00:00:00+00:00 List-Id: In article , Robert Dewar wrote: >Note that GNAT whereever possible follows the advice in the RM even if >it causes portability troubles. A common example is the following > > type arr8 is array (1..8) of boolean; > for arr8'size use 8; > >The RM permits the size clause to cause implicit packing, but recommends >against it. It would be pretty hard for the RM to do anything more than "recommend" here. After all, the compiler is allowed to use 1-bit components all the time (even if that's not a good idea), or to use 1-bit components if the program is compiled on a the first Tuesday of the month (an even worse idea!), or to follow the phase of the moon. Given that, how could the RM do more than "recommend"? >... VADS at least permitted this implicit packing (even though >there was an AI that recommended against it). One can't blame VADS *too* much. The AI appeared after VADS had implemented some particular mechanism. Ada 95 merely codified the AI into the RM. >Consequently in GNAT, we reject the above, and require an explicit pragma >Pack. Or, presumably, a "for arr8'Component_Size use 1;". Good. >... The workdaround for existing code here is easy, and the code is >arguably clearer with the pragma there in any case. > >However, if you have code that depends on close packed 3 bit components, >you are completely up the creak if your compiler does not support it! And, also unfortunately, the RM doesn't nail down what 3-bit components would mean. On a 32-bit machine, it might mean 10 3-bit components per word, with a 2-bit wastage in each word, or it might mean 3-bit components, crossing word boundaries, with no wastage. Sigh. I don't feel *too* bad about that -- other languages with similar features (eg packed arrays in Pascal) are even less specific. - Bob