I'm moving my C++ codebase from Visual Studio 2k3 to Visual Studio 2k8. Code contains
#pragma optimize( "a", on )
MSDN says that it means "assume no aliasing". Later versions of VS refuse to compile this and MSDN doesn't seem to say what to do with code containing this #pragma.
What does "assume no aliasing" mean and how to I make a decision on what to do with this line of code?
Aliasing is when you have stuff like this:
int a[100];
int * p1 = &a[50];
int * p2 = &a[52];
Now a, p1 and p2 are all aliases for the array, or parts of it. This situation can prevent the compiler from producing optimal array access code (FORTRAN forbids it, which is why it is so good with array performance).
The pragma you are asking about says that the compiler can assume the above situation doesn't exist. Obviously, if you need to decide whether you need this you can do one of two things:
The choice is yours :-)