delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/01/06/23:27:59

Date: Fri, 7 Jan 2000 09:16:48 +0500 (MVT)
From: Prashant TR <prashant_tr AT yahoo DOT com>
To: Groman <groman AT thehelm DOT com>
cc: djgpp AT delorie DOT com
Subject: Re: Data padding?
In-Reply-To: <00010709142100.00453@yahoo>
Message-ID: <Pine.LNX.4.10.10001070914390.548-100000@yahoo.com>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com
Errors-To: dj-admin AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com


On Thu, 6 Jan 2000, Groman wrote:

> I have a struct...and I need djgpp to leave it the way I declare it without
> any padding or aligning it to machine words...
> 
> for example
> 
> struct Lalala {
>     unsigned int testing1;
>     unsigned char testing2;
>     unsigned short testing3;
>     unsigned char testing 4;
> }
 
Use

 struct Lalala {
     unsigned int testing1 __attribute__ ((packed));
     unsigned char testing2 __attribute__ ((packed));
     unsigned short testing3 __attribute__ ((packed));
     unsigned char testing 4 __attribute__ ((packed));
 }
 

Prashant
---------------------------------------------------
One pound of learning requires ten pounds of common
sense to apply it.

- Raw text -


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