From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jamie Lokier To: mark@codesourcery.com Cc: ak@muc.de, toon@moene.indiv.nluug.nl, law@cygnus.com, jbuck@Synopsys.COM, torvalds@transmeta.com, craig@jcb-sc.com, davem@redhat.com, chip@perlsupport.com, egcs@egcs.cygnus.com Subject: Re: Linux and aliasing? Date: Sat, 05 Jun 1999 12:41:00 -0000 Message-id: <19990605214133.A15508@pcep-jamie.cern.ch> References: <18757.928523657@upchuck.cygnus.com> <37591A00.ACE54339@moene.indiv.nluug.nl> <19990605152349.A1923@fred.muc.de> <19990605104107T.mitchell@codesourcery.com> <19990605104107T.mitchell@codesourcery.com> X-SW-Source: 1999-06/msg00206.html mark@codesourcery.com suggests: > Put expressions of the form `*((foo*) (&x))' in alias set zero if > x does not have type foo, or one of the types that is allowed > to alias it. > > This proposal only affects nonconforming code, and thus changing the > behavior of the compiler will not pessimize any conforming code. I don't like this because it's not what we do in C++. In C++ when we want to do these naughty things, we used to do: *(foo*)(void*)(&x) I bet there's still a fair bit of that around. In the modern world we've got *reinterpret_cast(&x), which is presumably treated specially w.r.t. aliases. [Could someone tell me if reinterpret_cast does the right thing with aliases please?] thanks, -- Jamie From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jamie Lokier To: mark@codesourcery.com Cc: ak@muc.de, toon@moene.indiv.nluug.nl, law@cygnus.com, jbuck@Synopsys.COM, torvalds@transmeta.com, 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: <19990605214133.A15508@pcep-jamie.cern.ch> References: <18757.928523657@upchuck.cygnus.com> <37591A00.ACE54339@moene.indiv.nluug.nl> <19990605152349.A1923@fred.muc.de> <19990605104107T.mitchell@codesourcery.com> X-SW-Source: 1999-06n/msg00206.html Message-ID: <19990630154300.zrnnPwMrAeIkf2VM7G3rGeG_-zhJ2U1JwJTWE--yV28@z> mark@codesourcery.com suggests: > Put expressions of the form `*((foo*) (&x))' in alias set zero if > x does not have type foo, or one of the types that is allowed > to alias it. > > This proposal only affects nonconforming code, and thus changing the > behavior of the compiler will not pessimize any conforming code. I don't like this because it's not what we do in C++. In C++ when we want to do these naughty things, we used to do: *(foo*)(void*)(&x) I bet there's still a fair bit of that around. In the modern world we've got *reinterpret_cast(&x), which is presumably treated specially w.r.t. aliases. [Could someone tell me if reinterpret_cast does the right thing with aliases please?] thanks, -- Jamie