I was doing some small exercises in C with a friend, and I kept using keywords from newer languages (e.g. bool, new) out of habit. It took me a while to realize that was the issue because VS kept highlighting them as keywords, even though they aren't in C.
I made sure all of my files were *.c, and I set the project properties to compile as C. However, the editor always added syntax highlightint for C++ keywords in addition to C keywords. Is there any way to tell Visual Studio that I just want plain C?
Using VS2010 if it matters.
Take into account that some C++ features have been adopted by C (C99 std), such as the C++-style comments (//), or the boolean (bool) data type.
You cannot. This is a known bug in Visual Studio. The "Intellisense" mechanism which is used for syntax coloring in Visual Studio is based on the EDG C++ compiler which Microsoft bought, since their Visual C/C++ compiler is poorly suited for the incremental parsing required to handle on-the-fly analysis of incomplete code. And the EDG compiler is C++ only.
You can see an example of this by creating a foo.c file which compiles as C. Then add to the file the following lines:
When you compile your program you will see the error message "A bunch of C code!" But when you look at the Visual Studio editor window, the C side will be grayed out and marked inactive, and only the C++ side will be colored! That's because the Intellisense syntax colorer, based on the EDG C++ compiler, believes that everything is C++.