delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/03/03/01:42:47

Date: Wed, 3 Mar 1999 08:39:46 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Shadow Seeker <werewolf AT stad DOT dsl DOT nl>
cc: djgpp AT delorie DOT com
Subject: Re: Real stupid problem.
In-Reply-To: <36dc14d8.14275007@news.tudelft.nl>
Message-ID: <Pine.SUN.3.91.990303083927.7979F-100000@is>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com

On Tue, 2 Mar 1999, Shadow Seeker wrote:

> >If you need to minimize this padding (e.g., if your program uses large
> >arrays of such structs, where padding will waste a lot of memory), lay
> >out structures so that the longer members are before the shorter ones. 
>  No, that won't do, I can't design the structs, I read datafiles that
> use them. But Endlisnis gave me a clue that works perfectly.
> 
>  Just add "__attribute__(packed)" behind the struct and things work
> just fine.

It's "__attribute__((packed))" (double parentheses).

This is all explained in the FAQ, btw.

- Raw text -


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