[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

VGUI Structure Packing Alignment



I have compiled VGUI with different structure packing options
(/zp2,/zp4,/zp8) using the Watcom 11 C++ compiler under Win32, and I
have not noticed any differences in VGUI behavior on the test
applications or my own applications.  In the VGUI install notes, Dr.
Wampler recommends two byte structure packing alignment (/zp2) under
Windows.  Unfortunately, most Win32 compilers default to /zp8, and Win32
may require eight for some libraries such as ODBC, so it becomes
worrisome.

Is two byte alignment really needed for VGUI under Win32?  If so, maybe
the appropriate header files should enforce the packing with something
like:

#pragma pack(push) // save the current packing alignment
#pragma pack(2)    // set two-byte alignment

...                // existing code here

#pragma pack(pop)  // restore the original packing alignment

Alternatively, the structure elements could be rearranged to avoid
alignment dependencies.

- Steve


Reply to: