| United States-English |
|
|
|
![]() |
HP Itanium-based Systems: HP aC++/HP C Programmer's Guide > Chapter 2 Command-Line OptionsData Alignment and Storage |
|
This section describes default data storage allocation and alignment for HP compiler data types. Data storage refers to the size of data types, such as bool, short, int, float, and char*. Data alignment refers to the way the HP compiler aligns data structures in memory. Data type alignment and storage differences can cause problems when moving data between systems that have different alignment and storage schemes. These differences become apparent when a structure is exchanged between systems using files or inter-process communication. In addition, misaligned data addresses can cause bus errors when an attempt is made to dereference the address. For information on unaligned data access, “Handling Unaligned Data”. Table 2-2 “Size and Alignment of HP Compiler Data Types” lists the size and alignment of the HP compiler data types: Table 2-2 Size and Alignment of HP Compiler Data Types
cc -Agcc -Wc,--fshort-enums foo.c aCC -Ag++ -Wc,--fshort-enums foo.c The -fshort-enums option is used with the -Agcc or -Ag++ options to cause each enum type to be represented using the smallest integer type that is capable of representing all values of the enum type. Because it changes the representation of types, the code generated is not binary compatible with code compiled without the option. The primary use of this option is for compatibility with gcc, but it can provide performance improvement to applications that can accept the binary incompatibility. +unum The +unum option allows pointers to access non-natively aligned data. This option alters the way that the compiler accesses dereferenced data. Use of this option may reduce the efficiency of generated code. Specify num as 1, 2, or 4, as follows: 1 - Assume single byte alignment. Dereferences are performed with a series of single-byte loads and stores. 2 - Dereferences are performed with a series of two-byte loads and stores. 4 - Dereferences are performed with a series of four-byte loads and stores. Example: aCC +u1 app.C |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||