TEAM-ADA Archives

Team Ada: Ada Programming Language Advocacy


Options: Use Classic View

Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Topic: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
"W. Wesley Groleau x4923" <[log in to unmask]>
Thu, 22 Oct 1998 17:17:48 -0500
text/plain (40 lines)
> >Since the RM95 language is not clear (the AARM didn't help), you could
> >argue that the representation is indeed four bits, but that the "storage
> >allocated" is indeed 32.  I think (1) this is avoiding the issue that the
> >behavior is counterproductive, and (2) the AARM does NOT suggest the
> >meaning of 'Size has changed that much.
> Unfortunately, the ARM language IS clear, and it is required behavior for
> all Ada 95 compilers to change. I think that is why GNAT added 'Object_Size
> == to provide the Ada 83 typical definition of size.
> Ada 83 didn't define 'Size at all, and there was as many ideas of what 'Size
> meant as there were implementors. That is why you don't see a "change"
> in the AARM - it is just specifying something that was unspecified in Ada 83.
> Unfortunately, the writers of the ARM had in mind a model that was very
> different from existing practice. I know I complained about the change at
> the time, but apparently most other reviewers failed to notice that it would
> affect their programs, too.
> In any event, do not blame this on Apex -- all Ada 95 compilers must have
> this behavior. Any that don't are wrong.

Ada '83 said "the number of bits allocated for the object."  That seems pretty
clear to me.

Ada '95 says "the size in bits of the representation"  That is far from
clear.  What is the "representation"?  In binary, 1010, 01010, 00001010,
and 00000000000000000000000000001010 are all valid representations of the
number of fingers on my hands.  If the latter is stored at addresses A ..
A+3 yet 'Size is reported as 4, while 'Address is A, that is absurd.  I
find it hard to believe that was the intent.  But without a definition of
"representation" who can say?  But changing "allocation" to
"representation" sure _looks_ like a change!

Ada '95 is quite clear about 'size of a subtype, however.

Your last sentence implies that GNAT 3.10p is wrong -- it says the 'Size
of the object is 8 when the 'size of the type is 4.  (Of course it is
certainly possible that GNAT is wrong, but at least they give a 'Address
that include the bits we want!)