Search notes:
cl /T…
The
/T…
option of the
Visual C compiler allows to specify the filetype/language (
C and
C++) of the source being compiled.
/Tc
specifies a C file, /Tp
a C++ file, /TC
specifies that files by default are C files and /TP
that files by default are C++ files.
This can be demonstrated with the following simple source file:
int main () {
int new = 42;
return new;
}
Because it has a variable that is named new
and new
is a keyword in C++, the file is not valid C++.
The following invocation of the compiler specifies that the file is a C file and thus produces invalid-cpp-but-valid-c.exe
:
cl /Tc invalid-cpp-but-valid-c
However, compiling it with
cl /Tp invalid-cpp-but-valid-c
results in
invalid-cpp-but-valid-c(2): error C2059: syntax error: 'new'
invalid-cpp-but-valid-c(3): error C2059: syntax error: ';'