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, MSGID_RANDY autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,575ebd8d7a510349 X-Google-Attributes: gid103376,public From: Robert Dewar Subject: Re: Porting Ada83 to Ada95 compiler/VxWorks Date: 1999/11/12 Message-ID: <80h78f$nf7$1@nnrp1.deja.com>#1/1 X-Deja-AN: 547736455 References: <382B4F79.F8B31A68@averstar.com> X-Http-Proxy: 1.0 x30.deja.com:80 (Squid/1.1.22) for client 205.232.38.14 Organization: Deja.com - Before you buy. X-Article-Creation-Date: Fri Nov 12 14:12:34 1999 GMT X-MyDeja-Info: XMYDJUIDrobert_dewar Newsgroups: comp.lang.ada X-Http-User-Agent: Mozilla/4.04 [en] (OS/2; I) Date: 1999-11-12T00:00:00+00:00 List-Id: In article <382B4F79.F8B31A68@averstar.com>, Tucker Taft wrote: > 1) type Character now has 256 enumeration literals > 2) library packages must *not* have a body ... > 3) you need to decide in a generic ... In our experience, much more important is > 4) the meaning of 'Size has changed radically In Ada 83, the meaning of 'Size was not completely well specified but in practice, was very uniformly implemented. In particular, sizes of subtypes generally matched sizes of the base types, so for example, Natural'Size was the same as Integer'Size, typically 32. As far as I know, the only Ada 83 compiler implementing something different was the very rarely used Intermetrics compiler for the IBM mainframe, but I am happy to be corrected on this if someone knows some other compiler ... In Ada 95, an attempt was made to define 'Size more precisely (a good thing), but the choice made, though formally consistent with the lack of specification in the Ada 83 RM, was to insist that Natural'Size be 31 (a very bad thing). This actually violates one of the requirements in the Ada 95 requirements not to introduce incompatibilities with existing practice, but unfortunately this did not get fixed in the revision process. What this means is that a declaration like type x is record A : Natural; B : Character; end record; for x use record A at 0 range 0 .. Natural'Size - 1; B at 0 range 0 .. Natural'Size .. Natural'Size + 7; end record; has radically different semantics in typical Ada 83 compilers and Ada 95. Yes, from a formal point of view this is indeed in Tuck's category of implementation dependent code, but that is really a formalism. In practice this was a definitely incompatible mistake in the Ada 95 design, and is something to watch out for. Similarly suprising is: type x is array (1 .. 10) of Natural; pragma Pack (x); In an Ada 83 compiler, this would never pack to 31 bits, since Natural'Size is 32 bits, but in Ada 95 compilers it may pack to 31 bits causing porting problems. This has been one of the biggest porting headaches that I would really put in the category of incompatible changes, rather than ill-advised or ill-understood implementation dependent code (indeed the record rep clause above is clearly a concientious attempt to AVOID being implementation dependent). Sent via Deja.com http://www.deja.com/ Before you buy.