10

Can you tell me what are the __DEFAULT__, implicit compiler options for cl.exe and for link.exe when compiling from the command line, like:

cl whatever.c

Thanks!

update: To clarify: I am not interesed in the available command line options, I have even linked them from the question. What I am asking for is a list of implicit, default command line options used when you specify none and compile from the command line.

3
  • Assumption Alert: the default behavior does not always match a command-line option. E.g. the default behavior "disable code analysis" has no command-line option; the only command-line option is /analyze (Enable code analysis)
    – MSalters
    Nov 2, 2009 at 10:32
  • @MSalters Can you give an alternative example? The one you described can be achieved by passing /analyze- (see here).
    – JBentley
    Mar 17, 2014 at 1:05
  • 1
    @JBentley: It was literally the first one I found alphabetically (Probably VS2008 then). There are still such flags, e.g. /GF.
    – MSalters
    Mar 17, 2014 at 8:35

3 Answers 3

5

There does not seem to be much information on the actual defaults on microsoft web sites, however Geoff Chappell seems to have done some research into this subject. Here is the link:

http://www.geoffchappell.com/viewer.htm?doc=studies/msvc/cl/cl/initial.htm&tx=27

As we all know what the documentation says, and what the software actually does, are two different things.

To further answer the question, you can see what options cl passes to the compiler modules c1xx.dll and c2.dll by passing the /Bd option to cl:

cl /Bd helloworld.cpp

To see the environment variables that the compiler and linker uses type:

cl /Be helloworld.cpp
1
1

I always just search google for "cl options".
This is the current top hit: Compiler Command-Line Syntax (C++) [MSDN]

As is usual for Microsoft documentation, it is a bit haphazard, but it does seem to be complete. When an option is the default setting, that is noted (not in any consistent manner, though.)

2
  • 1
    Why can't people differentiate between "available command line options" and "default command line options"? See, when you compile a .c file without specifying compiler options some of them will be turned on by default, implicitly.
    – user200557
    Nov 1, 2009 at 18:51
  • My answer did address that issue, so perhaps it is you who lacks reading comprehension. Nov 2, 2009 at 10:23
0

Check cl /? on link /? at the command line. I believe that the defaults differ for each version.

2
  • This only lists the available compiler options, not the default compiler options.
    – user200557
    Nov 1, 2009 at 18:20
  • Hmm... I could have sworn that the description mentioned the defaults. I don't have a Windows box here so I can't check right now.
    – D.Shawley
    Nov 1, 2009 at 23:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.