Linux and aliasing?

Linus Torvalds
Sun Jun 6 14:17:00 GMT 1999

On Sun, 6 Jun 1999 wrote:
> Right.  But the part that's causing aliasing issues is just a memcpy;
> that's the `*(u32 *) p' bit.   You could write:
>   memcpy (&a, p, sizeof (a));
>   a = ntohl (a);

Which is crap.

And a compiler that requires you to write code like that is, by

If it comes to examples like the above, then "generated code" is not the
major point of contention any more. Bad syntax and requireing programmers
to do ludicrous things _is_ the issue. 

Language design is not just about making it easy for the compiler.  It's
also about making things easy to do for the programmer.  The above is BAD! 

If you can't see why

	a = ntohl((u32 *) p);

is better than the horrible thing you're suggesting (regardless of whether
the code generated is the same or not), then I might as well throw in the
towel immediately. The whole point of my suggestion was to make good code
generation possible with an interface that you can actually use without


More information about the Gcc mailing list