struct sizeof result not expected

前端 未结 4 955
挽巷
挽巷 2020-12-07 02:50

I have a a struct defined thusly:

typedef struct _CONFIGURATION_DATA {
    BYTE configurationIndicator;
    ULONG32 baudRate;
    BYTE stopBits;
    BYTE par         


        
4条回答
  •  孤街浪徒
    2020-12-07 03:22

    The extra size you are measuring is the padding introduced by the compiler.

    Presumably, you are working on a 32 bits system, so you will have 3 bytes of padding between configurationIndicator and baudRate, and 3 more bytes of padding at the end of the struct.

提交回复
热议问题