www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/12/10/17:05:35

Date: Mon, 09 Dec 1996 09:57:44 +0000
From: Bill Currie <billc AT blackmagic DOT tait DOT co DOT nz>
Subject: Re: Padding Question
To: tehmul%NIITPUN AT iris DOT ernet DOT in
Cc: djgpp AT delorie DOT com
Reply-to: billc AT blackmagic DOT tait DOT co DOT nz
Message-id: <32ABE298.F11@blackmagic.tait.co.nz>
Organization: Tait Electronics NZ
MIME-version: 1.0
References: <4C6D083001E72A00 AT iris DOT ernet DOT in>

tehmul%NIITPUN AT iris DOT ernet DOT in wrote:
> Yes.  (I'm sure someone will tell you to RTFM :)  But anyway, here goes:
> 
>      struct junk
>      { //structure details
>      } __attribute__((packed));
> 
> That ought to do it.  But read the FAQ, there's a real wealth of info there.

Unfortunatly, that only works in C.  C++ requires you to put 
__attribute__((packed)) on all the members instead (or at the beginning
of the
structure, but that seems to have a bug and doesn't seem to work).

If you code only for C and never expect the structure to be used in a
c++ program,
the above will work just fine.

Bill
-- 
Leave others their otherness.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019