Re: pragma Convention ignored (sometimes)
- From: "Jeffrey R. Carter" <spam@xxxxxxxx>
- Date: Fri, 04 Nov 2005 05:19:13 GMT
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 .
- References:
- Gnat 3.15p pragma issues
- From: Erik Woulfe
- Re: Gnat 3.15p pragma issues
- From: Colin Paul Gloster
- Re: Gnat 3.15p pragma issues
- From: Robert A Duff
- pragma Convention ignored (sometimes)
- From: Anonymous Coward
- Gnat 3.15p pragma issues
- Prev by Date: Re: I don't know what the compiler wants to tell me
- Next by Date: Re: Default rep specs for record types - documented??
- Previous by thread: pragma Convention ignored (sometimes)
- Next by thread: Re: Gnat 3.15p pragma issues
- Index(es):
Relevant Pages
|