If you want to find out how many bytes a certain portion of a struct uses,
you might be tempted to do some arithmetic with sizeof
, but this will
yield unpredictable results!
- 2020年10月19日
- 2 分
Always use offsetof
If you want to find out how many bytes a certain portion of a struct uses,
you might be tempted to do some arithmetic with sizeof
, but this will
yield unpredictable results!