Structure size directives
- From: jacob navia <jacob@xxxxxxxxxx>
- Date: Mon, 03 Dec 2007 20:45:21 +0100
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.
--
jacob navia
jacob at jacob point remcomp point fr
logiciels/informatique
http://www.cs.virginia.edu/~lcc-win32
.
- Follow-Ups:
- Re: Structure size directives
- From: Flash Gordon
- Re: Structure size directives
- From: Walter Roberson
- Re: Structure size directives
- From: Tor Rustad
- Re: Structure size directives
- From: Kenneth Brody
- Re: Structure size directives
- From: Walter Roberson
- Re: Structure size directives
- From: Walter Roberson
- Re: Structure size directives
- Prev by Date: Re: format for double for printf
- Next by Date: Re: traversing a stack
- Previous by thread: White space at the end of a line
- Next by thread: Re: Structure size directives
- Index(es):
Relevant Pages
|