The following options restrict or preclude the compiler's ability to optimize your program:
Option | Description |
---|---|
-O0 | Disables optimizations. Enables the -fp option. |
-mp | Restricts optimizations that cause some minor loss or gain of precision in floating-point arithmetic to maintain a declared level of precision and to ensure that floating-point arithmetic more nearly conforms to the ANSI and IEEE*standards. |
-g | Specifying the -g option turns off the default -O2 option and makes -O0 the default unless -O1, -O2, or -O3 is explicitly specified in the command line together with -g. |
-nolib_inline | Disables inline expansion of intrinsic functions. |
Note
You can turn off all optimizations for specific functions by using #pragma optimize. In the following example, all optimization is turned off for function foo():
#pragma optimize("", off) foo(){ ... } |
Valid second arguments for #pragma optimize are "on" or "off." With the "on" argument, foo() is compiled with the same optimization as the rest of the program. The compiler ignores first argument values.