/Ow - Assume Aliasing Across Function Calls

This option tells the compiler that no aliasing occurs within function bodies. Aliasing might occur across function calls. After each function call, you must reload pointer variables from memory.

The following rules must be followed for any variable not declared as volatile, or else /Oa and /Ow are ignored. In these rules consider a variable referenced if it is on either side of an assignment or if a function uses it in an argument:

  • No pointer references a variable used directly.
  • If a pointer to a variable is used, no function uses the variable directly.
  • If a function takes a variable address, the function does not use that variable directly.
  • If a function uses a pointer to modify a memory location, the function does not use a pointer to access the same location.

Aliasing bugs most frequently show up as corrupted data. If variables are assigned seemingly random values, compile the program with /Od - Disable Optimization. If the program works when compiled with the /Od option, do not use /Oa or /Ow.

Note   You can disable optimizations around code that uses aliasing for individual functions by using #pragma optimize with the a or w option.

See Also

About Microprocessor Compilers | ARM Guide | Hitachi Guide | MIPS Guide

 Last updated on Thursday, April 08, 2004

© 1992-2003 Microsoft Corporation. All rights reserved.