Does VS use the use of the C compiler for C and the C ++ compiler for C ++?
No
The cl compiler is smart enough to know (based on the file extension) if the file is a .cpp or .cc file, which it treats as a C ++ file. And the cl compiler will consider the .c file as the source C program file and compile it accordingly. Although it downloads a separate dll file to compile C and C++ files. But this implementation is defined.
However, there is a switch to override cl behavior based on file extension.
To compile the C ++ source file (even with the extension .c ), the command would be: cl /TP yourfile.c Note that the file must contain valid C ++ code.
And to compile as the source C file (with the extension .cpp ) the command will be: cl /TC yourfile.cpp note that the file must contain valid C code.
source share