Baranyai L�szl� <[EMAIL PROTECTED]> wrote:
> Dear "rc",
> 
> First of all, thank you for your answer.

You're welcom, but, well, I wish i'd been more help!

> > > written in C and has strange result: the 14 byte structure allocates 16
> > > bytes, the 3 byte structure requires 3 bytes !?
> >
> > Interesting.  Is this x86 linux or sparc linux?  What compiler?
> >
> PC: 586 (Celeron)
> Compiler: gcc-2.95.2

The reason I'd asked is that for some architectures you MUST
pad structures or suffer a big hit to rebuild the ints and such
byte at a time.

However, after reading the gcc man page 2 or 3 times (not completely!),
I see that there is no option in gcc to turn off structure padding.

> ...
> > forgotten the compiler option to do that.  check the man page...
> These options - according to the manual - are (?):
> -mcode-align
> -mno-code-align
> -mstrict-align
> -mno-strict-align
> -mold-align
> Unfortunately the compiler replied:
> cc1: Invalid option '__what_was_selected__'

oops.  Those are only for a certain cpu, not the x86 group.
Sorry!

> The manual mention a pragma:
> #pragma align 1
> which is assumed in all programs and its appearance in source
> had no effect.

Again, it turns out thats for a different CPU.

So, I suppose the short answer now is:

Its padding added by the compiler to make things end up aligned
the way it wants, and you cannot turn it off.

(Thats what i get for confusing the options on Sun's compiler with
those in gcc!)

rc


Rusty Carruth          Email:     [EMAIL PROTECTED] or [EMAIL PROTECTED]
Voice: (480) 345-3621  SnailMail: Schlumberger ATE
FAX:   (480) 345-8793             7855 S. River Parkway, Suite 116
Ham: N7IKQ @ 146.82+,pl 162.2     Tempe, AZ 85284-1825
ICBM: 33 20' 44"N   111 53' 47"W

Reply via email to