From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jason Merrill To: "Martin v. Loewis" Cc: egcs@egcs.cygnus.com Subject: Re: Linux and aliasing? Date: Wed, 30 Jun 1999 15:43:00 -0000 Message-ID: References: <199906060817.KAA00715@mira.isdn.cs.tu-berlin.de> <199906070645.IAA00615@mira.isdn.cs.tu-berlin.de> X-SW-Source: 1999-06n/msg00248.html Message-ID: <19990630154300.544muvCEkuzpDt6W4cDp5_2Fz9efb_WGt1XitacODOs@z> >>>>> Martin v Loewis writes: > We don't really emit *bad* code: garbage in, garbage out. People will > run into problems, yes. We will advertise this new feature in big > letters, and people will recompile with -fno-strict-aliasing, and then > see whether it still breaks (for some other reason). If it was an > aliasing problem, we can tell them that their code was not C. My problem with this is that only people who read the release notes for *this release* will see the big letters. Meanwhile, people who start with a later version or aren't involved in deploying the tools or whatever won't see the warning. Meanwhile, casts are an intuitive way to achieve the desired effect, much more obvious than unions, so people who haven't been explicitly warned will continue to write code that uses unsafe casts, without realizing that it will break. Saying "garbage in, garbage out" is a cop-out. If we're going to let code like this break, we need to emit a warning so that people know that they have a problem, rather than leaving them to debug obscure problems. BTW, the union trick isn't part of C, either. It's a GCC implementation choice. Jason