Is it always the case that sizeof(T) >= alignof(T) for all object types T?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: For any object type T is it always the case that sizeof(T) is at least as large as alignof(T) ? Intuitively it seems so, since even when you adjust the alignment of objects like: struct small { char c; }; above what it would normally be, their "size" is also adjusted upwards so that the relationship between objects in an array makes sense while maintaining alignment (at least in my testing . For example: struct alignas(16) small16 { char c; }; Has both a size and alignment of 16. 回答1: At least in standard C++, for anything you can make an