ID: Q84478
7.00 | 1.00 1.50 MS-DOS | WINDOWS kbtool kbprb
The information in this article applies to:
- Microsoft C/C++ for MS-DOS, version 7.0
- Microsoft Visual C++ for Windows, versions 1.0 and 1.5
In Microsoft C/C++ version 7.0 and Visual C++ version 1.0, generating p- code with the /Oq compiler option or with the following pragma
#pragma optimize( "q", on )
seems to disable other specified optimizations. Even using
#pragma optimize( "q", off )
does not seem to restore optimization to the remaining native code.
This is a limitation of the p-code compiler. Any native code functions in a module compiled for p-code will get a /f level of optimization.
Break the module into two modules, one that uses native code and another that uses p-code.
The following sample code can be used to demonstrate the behavior. When compiled with /Olz, the code generated for the for loop places a 1 into j and returns. With /Oqlz, this optimization does not occur.
/* Compile options needed: /Oqlz /Fc
Compile options needed: /Olz /Fc
Compare the resulting listings generated by /Fc
*/
#pragma optimize( "q", off )
int main( )
{
int i, j;
for( i=0; i<10; i++ ) /* This loop should be optimized away. */
{
j = 1;
j = 1;
j = 1;
j = 1;
j = 1;
}
return j;
}
Additional reference words: 7.00 8.00 8.00c 1.00 1.50 pcode KBCategory: kbtool kbprb KBSubcategory: CLIss Keywords : kb16bitonly
Last Reviewed: July 18, 1997