symbian, 字节对齐

The GCC compiler ignores "#pragma pack" statement when compiling for ARM platform, so you should use "__attribute__((packed, aligned))", like this:

#if defined(__WINS__)
#define PACKED
#else
#define PACKED __attribute__((packed, aligned(1)))
#endif

#pragma pack(1)

typedef struct {
char sig[104];
unsigned char verl,key;
int nFile, dFile, crc;
}PACKED avl1;

typedef struct {
char name[22];
int length, crc32;
}PACKED avd1;

#pragma pack(4)

原文:http://discussion.forum.nokia.com/forum/showthread.php?t=75596 

你可能感兴趣的:(symbian, 字节对齐)