GNU compatibility: alignof applied to packed fields

In GNU modes, applying the __alignof operator to a field selection operation for a packed field now produces the value 1.  (Previously, the "packed" attribute was ignored in such cases.)  For example:

struct S { int i __attribute__((packed)); } s;

int main() {

return __alignof(s.i); // Returns 1.

}

 

Einzelheiten zur Compiler-Optimierung finden Sie in unserem Optimierungshinweis.
Tags: