该程序:
struct alignas(4) foo {};
int main() { return sizeof(foo); }
返回4,GCC 10.1和clang 10.1,icc 19.0.1。
That makes me wonder - is it mandatory for alignas()
to affect sizeof()
this way? i.e. increase the size beyond what the structure would originally be sized at? Or - is this change just the implementation's prerogative?