Is the size of a struct required to be an exact multiple of the alignment of that struct?

前端 未结 9 2087
萌比男神i
萌比男神i 2020-11-28 13:00

Once again, I\'m questioning a longstanding belief.

Until today, I believed that the alignment of the following struct would normally be 4 and the size would normall

9条回答
  •  臣服心动
    2020-11-28 13:19

    The standard says very little about padding and alignment. Very little is guaranteed. About the only thing you can bet on is that the first element is at the beginning of the structure. After that...alignment and padding can be anything.

提交回复
热议问题