http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55428



--- Comment #5 from Andreas Kasberger <kasberger at heidenhain dot de> 
2012-11-26 09:51:50 UTC ---

I found this example on

geeksforgeeks.org/forum/topic/c-structure-size-with-empty-bitfield



#define offset(a,b) (size_t)(&(((a*)(0))->b))

struct emp

{

char s:8;

char c:7;

char d:2;

int:14;

char u;

char g:2;

}e;



int l;

l = offset(struct emp,u);

printf("%d %d",sizeof(struct emp),l);



With this example it is impossible to get vsc++ /zp4 results with gcc options

without changing the souce code itself.

The ms compiler result is "12 8" on gcc I will get mostly 6 4



I'm not able to align the bitfields in the way like ms do it.

Each single bitfield is aligned at word boundary.

Reply via email to