ANSI C++ and MS headers problem

ANSI C++ and MS headers problem

mariapsar2001的头像

Hello,
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.

Thanks

5 帖子 / 0 new
最新文章
如需更全面地了解编译器优化,请参阅优化注意事项
Brandon Hewitt (Intel)的头像

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.

Brandon
Intel Developer Support

For on-line assistance: http://support.intel.com/support/performancetools
For product support information: http://www.intel.com/software/products/support
* 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

Brandon Hewitt Technical Consulting Engineer Tools Knowledge Base: "http://software.intel.com/en-us/articles/tools" Software Product Support info: "http://www.intel.com/software/support"
mariapsar2001的头像

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?

Thanks!

Brandon Hewitt (Intel)的头像

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.

Brandon Hewitt Technical Consulting Engineer Tools Knowledge Base: "http://software.intel.com/en-us/articles/tools" Software Product Support info: "http://www.intel.com/software/support"
Brandon Hewitt (Intel)的头像

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.

Brandon Hewitt Technical Consulting Engineer Tools Knowledge Base: "http://software.intel.com/en-us/articles/tools" Software Product Support info: "http://www.intel.com/software/support"

登陆并发表评论。