Sunday, Nov 18th

Last update12:59:40 PM GMT

How the compiler make difference between C and C++?

Write e-mail

Most compilers differentiate by recognizing the file type by looking at the file extension.

You can also force the compiler to ignore the file type by supplying compiler switch. In MS VC++ 6, for example, the MSCRT defines a macro, __cplusplus. If you undefine that macro, then the compiler will treat your code as C code. You cannot define the __cplusplus macro. It is defined by the compiler when compiling a C++ source. In MSVC6 there's a switch for the compiler, /Tc, that forces a C compilation instead of C++.


Share this post

Web Hosting