| |||||
Technical Support Support Resources
Product Information | C166: BYTEALIGN DIRECTIVEInformation in this article applies to:
QUESTIONDoes the C166 Compiler support pointers to byte-aligned objects? ANSWERYes. This is accomplished with the BYTEALIGN directive. The BYTEALIGN directive causes the C166 Compiler to generate code that supports structure pointers that may start on byte boundaries. This directive is required when you use the PACK(1) directive. For example:
#pragma pack(1) /* byte alignment */
#pragma BYTEALIGN
struct s1 {
int i1; // i1 has offset 0
char c1; // c1 has offset 2
struct s2 {
int i2; // i2 has offset 3
char c2; // c2 has offset 5
int i3; // i3 has offset 6
} s2;
char z1; // z1 has offset 8
} s1;
struct s2 *s2p;
void main (void) {
s2p = &s1.s2; // pointer to bytealigned struct
s2p->i2 = 0; // access to bytealigned int
}
SEE ALSOFORUM THREADSThe following Discussion Forum threads may provide information related to this topic. Last Reviewed: Thursday, September 07, 2000 | ||||
| |||||