Mail Archives: djgpp/2001/11/06/09:26:59
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 -