Structure size directives



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
.



Relevant Pages

  • Re: Things to avoid typing at a command prompt
    ... What checks would you expect for bash scripts? ... do you want the equivalent of the WINDOWS ... are you so strident for changing gcc? ...
    (comp.programming)
  • Re: Need help with templated iterators
    ... I'm busy porting an old library that currently runs under Windows onto ... The other compilers you are using probably don't use strict two-phase ... GCC is being rather more standards conformant ... Printing on GNU/Linux? ...
    (comp.os.linux.development.apps)
  • Re: Best free C compiler for Windows?
    ... > The gcc guys are constantly working towards closing the gap with Intel ... As far as free compilers are concerned GCC seems to be the best ... I guess because of this all Windows ports of GCC are totally ...
    (comp.programming)
  • Can I use a DLL compiled with bcc with a program compiled with gcc?
    ... Can I use a DLL compiled with bcc with a program compiled with gcc (on ... I'm using Dev-C++ (an ... program (on Windows). ... no provision for open source compilers (library files ending with ...
    (comp.programming)
  • Re: Can I use a DLL compiled with bcc with a program compiled with gcc?
    ... > Can I use a DLL compiled with bcc with a program compiled with gcc (on ... > program (on Windows). ... > no provision for open source compilers (library files ending with ...
    (comp.programming)