ILE C/C++ Programmer's Guide

Differences in Using Packed Structures

The _Packed keyword tells the compiler to ignore the padding and pack the structure as much as possible.

C language onlyIn ILE C this keyword can be used in a structure definition and type definition.

C++ language onlyIn ILE C++, the same keyword can be used only in a type definition.

Table 17. Comparing Packed Structures

  ILE C/400 ILE C/C++
typedef _Packed struct {
   .
   .
}ps_t;
ok ok
_Packed struct {
   .
   .
}ps_v;
ok error

Therefore, you must make sure the _Packed keyword is used only in type definitions located in the header file.

C language onlyIn 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(R) #pragma pack directive.


[ Top of Page | Previous Page | Next Page | Table of Contents ]