Sun Studio 12: C User's Guide

E.1.9 Structures, Unions, Enumerations, and Bit-Fields (G.3.9)

E.1.9.1 (6.3.2.3) A member of a union object is accessed using a member of a different type:

The bit pattern stored in the union member is accessed, and the value interpreted, according to the type of the member by which it is accessed.

(6.5.2.1) The padding and alignment of members of structures.

Table E–5 Padding and Alignment of Structure Members

Type  

Alignment Boundary  

Byte Alignment  

char

Byte 

short

Halfword 

int

Word 

long (SPARC) v8

Word 

long (SPARC) v9

Doubleword 

float (SPARC)

Word 

double (SPARC)

Doubleword (SPARC)  

Word (x86) 

8 (SPARC)  

4 (x86) 

long double (SPARC) v8

Doubleword (SPARC)  

Word (x86) 

8 (SPARC)  

4 (x86) 

long double (SPARC) v9

Quadword 

16 

pointer (SPARC) v8

Word 

pointer (SPARC) v9

Quadword 

long long

Doubleword (SPARC)  

Word (x86) 

8 (SPARC)  

4 (x86) 

Structure members are padded internally, so that every element is aligned on the appropriate boundary.

Alignment of structures is the same as its more strictly aligned member. For example, a struct with only chars has no alignment restrictions, whereas a struct containing a double would be aligned on an 8-byte boundary.

(6.5.2.1) Whether a plain int bit-field is treated as a signed int bit-field or as an unsigned int bit-field:

It is treated as an unsigned int.

(6.5.2.1) The order of allocation of bit-fields within an int:

Bit-fields are allocated within a storage unit from high-order to low-order.

(6.5.2.1) Whether a bit-field can straddle a storage-unit boundary:

Bit-fields do not straddle storage-unit boundaries.

(6.5.2.2) The integer type chosen to represent the values of an enumeration type:

This is an int.