Running this on my alpha gives (gcc 4.0.2):

3000
0123456A01234567


Andrew Morton wrote:

>> Because networking does read/write "short" fields in various packet
>> header structures. Results are illustrated in a following example:
>>
>> char foo[] __attribute__((aligned(8))) = "0123456701234567";
>>
>> int main()
>> {
>>      short *bar = (short *)&foo[7];
>>      printf("%04x\n", *bar); /* 3037 */
>>      *bar = 0x4241; /* "AB" */
>>      printf("%s\n", foo);
>>      return 0;
>> }
>> --------
>> 0037
>> ^^
>> 0123456A01234567
>>         ^
>> Misalignment by two bytes for ints and longs is often unavoidable in
>> networking and we can cope with it, but there is no excuse of 1-byte
>> misalignment.


-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to