A-25 Bitfields of greater than field size

Jim Dehnert dehnert at baalbek.engr.sgi.com
Tue Feb 15 00:44:42 UTC 2000


> From: Jason Merrill <jason at cygnus.com>
> Date: 10 Feb 2000 12:43:55 -0800
> 
> It seems to me that
> 
> struct A {
>   ...
>   signed char c: 32;
>   ...
> };
> 
> should be treated like
> 
> struct A {
>   ...
>   int i: 32;
>   ...
> };
> 
> except that only the low 8 bits are significant.  This should be true
> whether or not there is actually a 32-bit type on the target.

In fact, I had been thinking that IF the primary purpose of this feature
is to allow known layout of (something like) an enum type without
knowing how big the compiler will make it, then Jason is right.
Specifically, the allocation of the field _with_ padding should be
based on the largest type that could fit in the specified size.
Where the real data goes (if there's a choice) doesn't much matter
then.  Lowest address would work (and lead to a consistent offset
and/or address).

Jim

-	    Jim Dehnert		dehnert at sgi.com
				(650)933-4272




More information about the cxx-abi-dev mailing list