KnowledgeBase Archive

An Archive of Early Microsoft KnowledgeBase Articles

View on GitHub

Q48089: Description of the /Or Switch

Article: Q48089
Product(s): See article
Version(s): 5.00 5.10 | 5.10
Operating System(s): MS-DOS | OS/2
Keyword(s): ENDUSER | | mspl13_c
Last Modified: 16-JAN-1990

Question:

When I run CL with the /HELP option to get command-line help, there is
listed an optimization flag, /Or, that is supposed to disable in-line
returns. I can't find information about this switch documented
anywhere else. What does this switch really do?

Response:

The term "in-line return" is misleading; there is not a call to the
return function that is eliminated. The /Or switch affects the code
that is produced for functions lacking local variables and/or formal
parameters.

If a function takes no formal parameters and has no local variables, a
stack frame is not necessary. /Or prevents stack frame creation and
clean-up code from being produced when possible. The code for
preservation and restoration of the SI and DI registers is also
eliminated.

The typical instructions that are eliminated are as follows:

   push bp     ; This code is used on entry
   mov  bp, sp ; to establish a stack frame.
   ...
   push di     ; This code is used on entry
   push si     ; to preserve SI and DI.
   ...
   ...         ; The code to perform the function
   ...         ; would be here.
   ...
   pop  si     ; This code is used on exit to
   pop  di     ; restore SI and DI, and to
   mov  sp, bp ; clean up the established
   pop  bp     ; stack frame.

THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Copyright Microsoft Corporation 1986-2002.