Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Struct member alignment

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Dear Members,

I want to know if MS Visual C++ does word alignment on struct members by default or by compilation flag?
 
By default the MS Visual C++ does the 8 bytes struct alignment (when no compilation flag is used).
To change the default alignment you may use the
Code:
/Zp
or
Code:
/pack
flag (are the same). You also may use
Code:
#pragma pack
directive to override the project aligmnent rule for all struct declarations below
Code:
#pragma pack
line.

E.g.:

Code:
/Zp1

#pragma pack (1)

Marius Samoila
Brainbench MVP for Visual C++
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top