This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: strict aliasing benefit examples



int f(int *a, float *b)
{
  *a = 1;
  *b = 2.0;
  return *a == 2;
}


Problem: people don't write code that way. (well I hope not) People declare a few local variables, load them with data via the pointers, do stuff with the local variables, then save back the results via the pointers.

So that won't convince many Visual Studio 2005 fans. :-(

Then, the answer is that GCC's stronger aliasing allows you to use one line of code instead of three.


Consider that most people can only write at most ~50 SLOC/day (including debugging and documentation), with a stunning independence from the programming language and programming style. If you take it with the necessary grain of salt, this is quite an argument.

Paolo


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]