On Wed, 2002-12-11 at 11:31, [EMAIL PROTECTED] wrote: > > But now let's do it back wards - assign the value of IA32 and test for > > it on PPC. On IA32 we put NULL in *first* of the bytes and leave junk in > > the other 3 padding bytes. On the PPC we then test whether these *four* > > bytes are zero. Because of the junk in the padding bytes they are not, > > so we fail the test. > > > > And actually now when I think about it, there's also a problem of > > endianity. Sorry, but I think that this is b0rken :-) >
> Michael did not specify *why* the size of the structures matters. If He just > wants to make comparison of swap usage between the computers, or to time the > access to fields within the structure, and not to transfer data, then he is > justified in using mere alignment. For both tasks you've described forcing the alignment on IA32 will not do him one bit (pun intended ;-) of good - it won't make access to the bool on IA32 any faster and it doesn't really say anything about the storage size either - the compiler *might* decide to resolve the issue with padding, but it can just as well decide to move around fields in the struct to make the alignment happen "naturally" and it can even decide to do nothing at all if the bool was aligned anyways. Again, assuming the size of non storage specific types or trying to force it to be something you happen to thin is right is simply the wrong way to go about it. Gilad, who spent the last week fighting with some IA32 driver that needs porting to IA64 and was written by someone who tried to use similar tricks instead of doing the Right Thing(tm) ;-) -- Gilad Ben-Yossef <[EMAIL PROTECTED]> http://benyossef.com "Denial really is a river in Eygept." ================================================================= To unsubscribe, send mail to [EMAIL PROTECTED] with the word "unsubscribe" in the message body, e.g., run the command echo unsubscribe | mail [EMAIL PROTECTED]