Subject: Re: CVS commit: basesrc/usr.bin/file
To: None <tech-userlevel@netbsd.org>
From: Christos Zoulas <christos@zoulas.com>
List: tech-userlevel
Date: 06/05/2002 18:26:53
In article <200206051730.NAA15817@Sparkle.Rodents.Montreal.QC.CA>,
der Mouse <mouse@Rodents.Montreal.QC.CA> wrote:

There is theory and practice. Most compilers do what you expect. If
they don't things will break, but fine *a lot* of things will break
that make similar assumptions, so that is no reason to worry.

christos

>There is no such thing as a "worst-case boundary" from a C point of
>view; the compiler is free to insert 43 pad bytes between two adjacent
>"char" elements if it happens to feel like it.  I'm not even certain
>there's a requirement that it lay out the same structure the same way
>on two different compilation runs, though there may well be, since as a
>practical matter not doing so would break separate compliation rather
>badly.
>
>Of course, since NetBSD uses gcc, we can to a certain extent depend on
>how gcc lays out structs.  But we have to be careful to make sure the
>host build tools lay out the struct the way the gcc-built reading code
>expects - or else, as has been mentioned, defer the binary file build
>until later, when it can be done by fully native code.
>
>And as you point out, there's binary compatability with the past to
>worry about.
>
>/~\ The ASCII				der Mouse
>\ / Ribbon Campaign
> X  Against HTML	       mouse@rodents.montreal.qc.ca
>/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B