comp.lang.ada
 help / color / mirror / Atom feed
From: jeff@thecreems.com
Subject: Ada83/95 Compatibility
Date: 13 Dec 2005 10:46:23 -0800
Date: 2005-12-13T10:46:23-08:00	[thread overview]
Message-ID: <1134499582.913837.213460@g43g2000cwa.googlegroups.com> (raw)

I am porting a large batch of Legacy Ada 83 code to an Ada 95 compiler.

One issue i have hit has to do with the 'size of subtypes. (not that
much of a surprise)

I was well aware that there were some differences to be expected in
this area
(e.g. natural'size being 31) but one thing that surprised me is with
this particular
compiler, even object sizes ended up being impacted.

For example

 type My_Big_Int is range -2**31 .. 2**31 -1 ;
 for My_Big_Int'size use 32;

 subtype little_range is My_Big_Int range 0 .. 255;


 A : My_Big_Int;
 B : Little_Range;

I was not surprised that Little_Range'size = 8


What surprised me was that b'size comes back as 8. I've re-read the
representation chapter again and I think the compiler is probably
within its rights to do this.

Since one can't specify a 'size on a subtype like this it appears that
there really is no way to specify a minimum size for a subtype.

While I obviously with B'size = 32 I am not 100% sure that I understand
the chapter well enough to convince myself that it really is a legal
outcome.

..Also note this is not GNAT (which appears to act as I'd expect for
targets I have access to).




             reply	other threads:[~2005-12-13 18:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-13 18:46 jeff [this message]
2005-12-14  6:18 ` Ada83/95 Compatibility Jeffrey R. Carter
2005-12-15  0:14 ` Randy Brukardt
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox