comp.lang.ada
 help / color / mirror / Atom feed
From: "Jeffrey R. Carter" <spam@spam.com>
Subject: Re: pragma Convention ignored (sometimes)
Date: Fri, 04 Nov 2005 05:19:13 GMT
Date: 2005-11-04T05:19:13+00:00	[thread overview]
Message-ID: <lbCaf.5450$Rl1.1293@newsread1.news.pas.earthlink.net> (raw)
In-Reply-To: <slrndmlnu9.kq0.bogus_addy@tango.mindfuq.org>

Anonymous Coward wrote:

>   type Some_Enum_Type is (one, two, three);
> 
>   pragma Convention (Convention => C, Entity => Some_Enum_Type);
> 
> should create a 32 bit enum, but in fact doing a 'size reveals that
> it's 2 bits!

By default, 'Size on a subtype gives the minimum # of bits to represent the 
values of the type. In this case, that would be 2. 'Size of an object is 
something else, and in this case is probably more like what you expect. Without 
the pragma Convention, I'd expect it to be 8 on x86 targets.

As an example, with GNAT, Integer'Size is 32 and Natural'Size is 31. An object 
of subtype Natural, however, is usually 32 bits.

If you explicitly define the size of a subtype (for X'Size use 23;), then 'Size 
on the subtype should give the defined value.

-- 
Jeff Carter
"Now go away or I shall taunt you a second time."
Monty Python & the Holy Grail
07



  reply	other threads:[~2005-11-04  5:19 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-03 15:03 Gnat 3.15p pragma issues Erik Woulfe
2005-11-03 16:00 ` Colin Paul Gloster
2005-11-03 22:56   ` Robert A Duff
2005-11-04  2:12     ` pragma Convention ignored (sometimes) Anonymous Coward
2005-11-04  5:19       ` Jeffrey R. Carter [this message]
2005-11-05  2:54         ` Justin Gombos
2005-11-03 17:42 ` Gnat 3.15p pragma issues Gautier Write-only
2005-11-03 23:00 ` Robert A Duff
2005-11-04  2:51 ` Steve
2005-11-04 13:02 ` Stephen Leake
replies disabled

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