Differences in Using Packed Structures
The _Packed keyword tells the compiler to ignore the padding and pack the structure as much as possible.
In ILE C, this keyword can be used in a structure definition
and type definition.
In ILE C++, the same keyword can be used only in
a type definition.
| ILE C | ILE C/C++ | |
|---|---|---|
|
ok | ok |
|
ok | error |
Therefore, you must make sure the _Packed keyword is used only in type definitions located in the header file.
In the ILE C/C++ compiler, the #pragma pack directive
applies only to C programs. The ILE C #pragma pack directive
is not compatible with the Windows #pragma
pack directive.