ANSI C++ and MS headers problem

ANSI C++ and MS headers problem

I'm the process of evaluating the Intel C++ compiler and I have a problem with ANSI C++ compliance. I'm using VC++ 6 as the IDE and have chosen "disable the language extensions to get proper for-loop scoping et al, however I get many errors from various microsoft header files that are included (_inline is undefined for example). Am I missing an option that remedies that? The same code compiles file on my other windows compiler so I'm pretty sure I'm not asking for something impossible.


5 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

You don't mention what other Windows* compiler you are using, but I'm betting it's not the Microsoft* Visual C++* 6.0 compiler because you can't get proper for-loop scoping on that compiler (via compiler option or otherwise). Microsoft's header files take advantage of the Microsoft "extension" to allow Microsoft-style for loop scoping (which violates ANSI C++), so when you disable this extension with our compiler, anything that uses Microsoft headers will not compile.

We provide the option for our users that use the Intel compiler with the Microsoft Visual C++ .NET compiler, the header files of which don't have this issue, I believe.

Intel Developer Support

For on-line assistance:
For product support information:
* Intel and Pentium are registered trademarks of Intel Corporation or its subsidiaries in the United States and other countries
* Other names and brands may be claimed as the property of others

I'm using Codewarrior as the other compiler.

The points that the Intel compiler barfs on have nothing to do with ANSI non-compliance. They do not violate the standard by say having bad loop scoping assuptions. They rather have things like custon keywords (like _inline and such).

It would make sense, to me, to have flags to enable ANSI compliance but also keep innocent MS keywords that don't mess with it. Is there such an option or am I out of luck?


Let me try to boil it down this way. If you're using Microsoft* Visual C++* 6.0 runtime headers and libraries (and what serious application on Windows* does not unless you're using a third party STL like stlport), and you try to compile code that includes VC++ headers with "real" ANSI C++ compliance enforced, then you will get errors. Microsoft's VC++ 6.0 headers and libraries are not ANSI C++ compliant.

The Intel C++ Compiler uses VC++ 6.0 headers and libraries, so we run into the same situation. If you want to turn on ANSI C++ compliance in any useful manner, then you can't use the VC++ 6.0 headers and runtimes. Alternatives are to use VC++ .NET or a third party STL.

As for the _inline keyword messages, I'm guessing that there is an earlier error that is ANSI standard related that prevents _inline from being defined in the headers which causes the subsequent "_inline not defined" error. I'll be more certain if I see a test case.

Leave a Comment

Please sign in to add a comment. Not a member? Join today