From mboxrd@z Thu Jan 1 00:00:00 1970 From: Linus Torvalds To: mark@codesourcery.com Cc: rth@cygnus.com, tim@wagner.Princeton.EDU, craig@jcb-sc.com, davem@redhat.com, chip@perlsupport.com, egcs@egcs.cygnus.com Subject: Re: Linux and aliasing? Date: Wed, 30 Jun 1999 15:43:00 -0000 Message-ID: References: <19990606104823N.mitchell@codesourcery.com> X-SW-Source: 1999-06n/msg00230.html Message-ID: <19990630154300.wA02DZh1KQsk-q-wM-YTjet0fbQ9AktdPq_orrDGBgs@z> On Sun, 6 Jun 1999 mark@codesourcery.com 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 implication.. 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 barfing.. Linus