Hello, everyone.
I write a struct, and i think its sizeof() test should is 9 not 11. but i use pelles c 7.0 execute it, tell me it's 11. in gcc , it is 9? can you resolve this puzzle?
typedef unsigned char __u8;
typedef unsigned short __u16;
typedef unsigned int __u32;
#pragma pack(1)
typedef struct packet_prefix {
__u8 start;
__u8 len;
struct {
__u8 commMode:6;
__u8 DIR:1;
__u8 PRM:1;
} control;
union {
struct {
__u8 routerID:1;
__u8 affiliatedNodeID:1;
__u8 commModuleID:1;
__u8 collisionDetection:1;
__u8 relayLevel:4;
__u8 channelID:4;
__u8 errorCorrectionCodeID:4;
__u8 responseBytes;
__u16 commBaudRate:15;
__u16 rateUnitID:1;
__u8 reserve;
} info_down;
struct {
__u8 routerID:1;
__u8 no_use1:1;
__u8 commModuleID:1;
__u8 no_use2:1;
__u8 relayLevel:4;
__u8 channelID:4;
__u8 no_use3:4;
__u8 phaseLineMark:4;
__u8 meterChannelFeature:4;
__u8 lastCommandSignalQuality:4;
__u8 lastResponseSignalQuality:4;
__u16 reserve;
} info_up;
}info;
} packet_prefix;
#pragma pack()