Re: ANSI C clarifications, with citations (was Re: [patch-2.4

Albert D. Cahalan (acahalan@cs.uml.edu)
Wed, 28 Jun 2000 03:28:17 -0400 (EDT)


Larry McVoy writes:
> Sandy said:
>> Rusty said:

> I'm sorry if my point was not clear; I was strongly reaction to
> Albert's assertion that his list of assumptions were reasonable
> for "a sane compiler and sane hardware". It is certainly not.
...
> It is not even true for the Linux kernel. As Sandy points out:
>
>> The assumption that really cracks me up is:
>>
>>>>> 7. You can freely cast between any two pointer types
>>
>> Cast a char * to int * on any architecture with strong alignmenmt
>> restrictions and watch your code commit messy suicide.

Oh no, the cast works perfectly well. The derereference is another
matter of course, and you'd better make sure you satisfy alignment
needs. Cast to long and mask off bits or cast to smaller types.

I'd not intended to imply you could ignore the alignment needs.
It never occurred to me that anybody would assume that, yet there
were 3 posts about alignment faults.

The not-so-sane hardware has word pointers and typed pointers.
Old 60-bit Crays, DSP chips, and the AS/400 virtual machine
have these problems -- and they will most likely never boot Linux.
The kernel would require _huge_ changes for this.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/