Quoting Gilad Ben-Yossef <[EMAIL PROTECTED]>:

[snip]

> 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 :-)

If Michael's intention is to use the struct to transfer information from one
architecture to the other, then you're absolutely right. Endianity is the
*first* thing to consider - Motorola is always the reverse of Intel. To transfer
information, don't use internal structs at all. Ever. Not even for text.
Translate to some exchange format, and document it well, including endianity,
character encoding, and all the little details.

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.

Herouth

=================================================================
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]

Reply via email to