KnowledgeBase Archive

An Archive of Early Microsoft KnowledgeBase Articles

View on GitHub

Q61616: CL.EXE Command-Line Switches Are Order Dependent

Article: Q61616
Product(s): See article
Version(s): 6.00   | 6.00
Operating System(s): MS-DOS | OS/2
Keyword(s): ENDUSER | | mspl13_c
Last Modified: 25-MAY-1990

With the Microsoft C version 6.00 compiler, command-line switches are
order dependent. For instance, the -Zr switch, which checks for null
pointers and out-of-range far pointers, must appear AFTER the -qc
switch. The option -Zr can be used only with the -qc (quick compile)
option. Therefore, the following is the correct method:

   cl -qc -Zr

The following is the incorrect method:

   cl -Zr -qc

Also, if two options are for the same feature, the last option
specified on the command-line will be used. Finally, CL environment
variables are added to the beginning of the command line, which may
alter the order of certain switches. The following are three examples:

1. CL /Ox /Od foo.c

2. CL /Od /Ox foo.c

3. set CL=/Od
   CL /Ox foo.c

Example 1 will disable optimizations, and Example 2 and 3 will enable
optimizations.

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.