Can someone tell me what optimisations might be enabled/disabled
by strict aliasing rules?
Is there some merit in a switch which allows coarse aliasing
optimisations, that is, allows optimisations based on integer
vs float vs pointer, but not on pointer vs pointer?
I have some code which makes aliases by pointer casting
to layout compatible types: optimisations based on the
type distinction would break the code. However aliasing
on incompatible types (eg pointer to float vs int) are
desired (rather -- I want the fastest possible code,
without breaking my pointer cast hackery).
BTW: one of the hacks is aliasing pairs like these:
struct X { T x; X(T a) : x(x) {} };
struct Y { T x[1]; };
in C++, so a constructor can initialise an array
of known length efficiently. (in C++ assignment
of default initialised value can cost more than
initialisation, and may even be impossible if
there is no default constructor).
--
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net