www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/11/06/09:26:59

Sender: salvador AT delorie DOT com
Message-ID: <3BE7F2B7.F6E2DE04@inti.gov.ar>
Date: Tue, 06 Nov 2001 11:24:55 -0300
From: salvador <salvador AT inti DOT gov DOT ar>
Organization: INTI
X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.2.19 i686)
X-Accept-Language: es-AR, en, es
MIME-Version: 1.0
To: djgpp AT delorie DOT com
Subject: Re: Holes in structure
References: <3BE7D280 DOT C1732E58 AT bigfoot DOT com> <9s8o2d$nl6$1 AT nets3 DOT rz DOT RWTH-Aachen DOT DE>
Reply-To: djgpp AT delorie DOT com

Hans-Bernhard Broeker wrote:

> > Here is some program that detects holes in structure.
>
> A rather useless exercise, that is.  You don't need to know or detect
> this kind of information.  If you think you have to, you should
> re-think the arguments that brought you to this conlusion.  At least
> one of them is flawed.

To add more to what Hans says: you can't depend on what happends inside a
structure, in some platforms the CPU can't even execute code that uses
missaligned elements so in this case some padding is mandatory. SPARC64 is a
case where you can't use missaligned accesses. In Linux/PPC this is logged
by the kernel as a warning. You must trust the compiler to make the right
stuff.
I forced things in my code I got not so nice surprises when it misserably
crashed with SIGBUS in SPARC machines.

SET

--
Salvador Eduardo Tropea (SET). (Electronics Engineer)
Visit my home page: http://welcome.to/SetSoft or
http://www.geocities.com/SiliconValley/Vista/6552/
Alternative e-mail: set AT computer DOT org set AT ieee DOT org
Address: Curapaligue 2124, Caseros, 3 de Febrero
Buenos Aires, (1678), ARGENTINA Phone: +(5411) 4759 0013



- Raw text -


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