"Marc A. Criley" a �crit dans le message news: 39ABAAE7.3B4BEF29@lmco.com... > We had a situation where there was a > > type Counts is range 0..128; > > that had a size clause: > > for Counts'Size use 32; > > This then had a subtype > > subtype Indicies is Counts range 1..128; > > Our expectation was that Counts'Size would be 32, and Indices'Size would be 32. > While that was in fact the case for the 'Size of Counts, Indices'Size turned out to > be 8. We researched this in the RM (and could find no statement requiring that a > type's size be passed on to its subtypes), and also went back to our compiler > vendor, and confirmed that this behavior was correct. It was, as Robert Dewar put > it, "in pure Ada 95...a nasty omission". While size specification is retained > through derivation, it is not through subtyping. And placing a Size specification > on a subtype is not permitted by the language. > > We ended up utilizing the parent type in the external interface, relying on the use > of the subytpe throughout the remainder of the module to ensure the proper > constraints were obeyed. It seems that you assumed that *variables* declared of subtype Indices would use Indices'Size bits - and this is a misunderstanding. Try this: with Text_Io; use Text_Io; procedure Essai is type Counts is range 0..128; for Counts'Size use 32; subtype Indices is Counts range 1..128; V_Counts : Counts; V_Indices : Indices; begin Put_Line ("Sizes:"); Put_Line ("Counts:" & Integer'Image (Counts'Size)); Put_Line ("Indices:" & Integer'Image (Indices'Size)); Put_Line ("V_Counts:" & Integer'Image (V_Counts'Size)); Put_Line ("V_Indices:" & Integer'Image (V_Indices'Size)); end Essai; You'll see (with Gnat) that V_Indices has size 32. In short: the 'Size for a (sub)type tells you the minimum number of bits required for it according to Shannon's theorem. If you want to check the size used by a variable, declare a variable and take its 'size. -- --------------------------------------------------------- J-P. Rosen (Rosen.Adalog@wanadoo.fr) Visit Adalog's web site at http://pro.wanadoo.fr/adalog