J
jacob navia
Since standard C doesn't provide any way for the programmer to direct
the compiler as to how to layout structures, most compilers provide some
way to do this, albeit in different forms.
Microsoft (and lcc-win) uses
#pragma pack(1)
Gcc uses
__attribute__ {(packed)}
Has anyone seen other directives in other compilers?
Specifically, Microsoft allows to pack structures with some integer
constant (pack(2) for instance), but gcc doesn't seem to allow this.
What other semantic differences could exist there?
I am writing this part of my tutorial, and I would like to make a table
about the constructs used by the various compilers. Note that under
windows you must know this kind of stuff since windows uses packed
structures extensively.
the compiler as to how to layout structures, most compilers provide some
way to do this, albeit in different forms.
Microsoft (and lcc-win) uses
#pragma pack(1)
Gcc uses
__attribute__ {(packed)}
Has anyone seen other directives in other compilers?
Specifically, Microsoft allows to pack structures with some integer
constant (pack(2) for instance), but gcc doesn't seem to allow this.
What other semantic differences could exist there?
I am writing this part of my tutorial, and I would like to make a table
about the constructs used by the various compilers. Note that under
windows you must know this kind of stuff since windows uses packed
structures extensively.