From: bpriest@ti.com (Bill Priest)
Subject: Size Rep clauses on Ada83 vs. Ada95
Date: 28 Mar 1995 17:08:12 GMT
Date: 1995-03-28T17:08:12+00:00 [thread overview]
Message-ID: <BPRIEST.95Mar28110812@ti.com> (raw)
Per 13.2 of Ada Programming Language Reference Manual (MIL-STD-1815a-1983)
" Size specification: T'SIZE
The expression must be a static expression of some integer type. The value
of the expression specifies an upper bound for the number of bits to be
allocated to objects of the type or first named subtype T. The size
specification must allow for enough storage space to accommodate every
allowable value of these objects. A size specification for a composite type
may affect the size of the gaps between the storage areas allocated to
consecutive components. On the other hand, it need not affect the size of the
storage area allocated to each component.
The size specification is only allowed if the constraints on T and on its
subcomponents (if any) are static. In the case of an unconstrained array type,
the index subtypes must also be static."
Any typos in the above are mine.
Code I have written for the Tartan Ada C3x compiler is behaving incorrectly;
a simple example illustrating the problem follows:
with text_io;
procedure test is
type x_type is new boolean;
for x_type'size use 32;
type y_record_type is
record
one : x_type;
two : x_type;
end record;
type position_array_type is array (0 .. 1) of natural;
y : y_record_type;
z : position_array_type;
begin
z(0) := y.one'position;
z(1) := y.two'position;
if (z (0) = z (1)) then
text_io.put_line ("Positions were equal.");
else
text_io.put_line ("Positions were not equal.");
end if;
end test;
The output of running this program is "Positions were equal."
Is this a illegal program or a compiler bug.
Thanks in advance,
Bill
next reply other threads:[~1995-03-28 17:08 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
1995-03-28 17:08 Bill Priest [this message]
1995-03-29 0:00 ` Size Rep clauses on Ada83 vs. Ada95 Tucker Taft
1995-03-30 0:00 ` Bill Priest
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox