__INTEL_COMPILER macro not visible to Intellisense

__INTEL_COMPILER macro not visible to Intellisense

We have tracked down an intellisense issue (Visual Studio) to the __INTEL_COMPILER macro not being visible to the intellisense processor. Instead, _MSC_VERis defined and has a value (1600), which causes code interpretation different from that performed by theIntel compiler. It also suggests that the Microsoft compiler has somehow informed the IDE of its version, and if that is true, the Intel compiler should be able to do the same thing. I have not been able todiscover any information on whether the compiler's internally defined macros should be visible to Intellisense.

Please comment on whetherthere is supposed to be a way forthe Intel compiler toexposeitsmacros to the IDE for such purposes.Any references torelevant documentation would be appreciated.

Thanks.

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

Please take a look at a topic'Predefined Macros' in MSDN ( C/C++ Preprocessor Reference ).

Mictosoft clearly states that the compiler recognizes two types of PredefinedMacros, that is, ANSI C and Microsoft specific.
Both types could be alsocalled as Builtin Macros.

_MSC_VER macro isthe macroof the 2nd type. __INTEL_COMPILER macrois Intel specific and it will neverbe
included into any list supported by the MS C/C++ compiler.

Quoting tpucke...Please comment on whetherthere is supposed to be a way forthe Intel compiler toexposeitsmacros to the IDE for such purposes.
Any references torelevant documentation would be appreciated...

I'd like to provide an example on how a support for different C/C++ compilers could be done for a project.

Instead of usinginternal C/C++compiler macros, like__INTEL_COMPILER or __ICC,a set of project specific macros
is used ( exception _MSC_VER macro ). Please note, that in that case IntelliSense recognizes all project specificmacros.

///////////////////////////////////////////////////////////////////////////////

// Supported Integrated Development Environments ( IDEs ) and C++ Compilers
...

#undef _CPPCOMPILER_VER
#undef _CPPCOMPILER_VER_BASE

#define _CPPCOMPILER_VER_BASE				( 2000							)
#if defined ( _WIN32_MGW )

	#define _GCC_VER						( _CPPCOMPILER_VER_BASE +  0342 )

#endif
#if defined ( _WIN32_BCC )

	#define _BCC_VER						( _CPPCOMPILER_VER_BASE +  0551 )

#endif
#if defined ( _COS16_TCC )

	#define _TCC_VER						( _CPPCOMPILER_VER_BASE +  0300 )

#endif
#if defined ( _WIN32_ICC )

	#define _ICC_VER						( _CPPCOMPILER_VER_BASE + 10000 )

#endif
///////////////////////////////////////////////////////////////////////////////
#if defined ( _WIN32_MSC )

	#define _CPPCOMPILER_VER				( _MSC_VER                      )

#endif

#if defined ( _WIN32CE_MSC )

	#define _CPPCOMPILER_VER				( _MSC_VER                      )

#endif
#if defined ( _WIN32_MGW )

	#define _CPPCOMPILER_VER				( _GCC_VER                      )

#endif
#if defined ( _WIN32_BCC )

	#define _CPPCOMPILER_VER				( _BCC_VER                      )

#endif
#if defined ( _COS16_TCC )

	#define _CPPCOMPILER_VER				( _TCC_VER                      )

#endif
#if defined ( _WIN32_ICC )

	#define _CPPCOMPILER_VER				( _ICC_VER                      )

#endif

...

Thanks foryour responses. I also posted an inquiry on this topic to Microsoft's Visual C++ forum,and their response is consistent.Your code sample is workable,though I feel that the heart of this issue is that intellisense is still interpretingsource code with a different compiler than the tool used to execute a real build. As long as that is true, techniques like this are just a band-aid.

Perhaps this is just dreaming, but it would be great if there could be an agreed techniqueby which a compiler couldpublish (in a file) or export(through an API) its compile time environment.This waythe IDE could utilize this information tohavea more legitimate awareness forbenefit of theuser. Itis silly foran IDE to provide for hooksto third party build tools, and then the IDE's user interface (Intellisense) marches to a totally different drum.

Maybe even better would be if the compiler could export relevant portions of its functionality so that the IDE could just call into the currentlyconfigured compilerto obtaincode awareness, instead of implementing its owndistinct compiler.

(Feature request...)

Quoting tpucke...I feel that the heart of this issue is that intellisense is still interpretingsource code with a different compiler than the tool used to execute a real build...
That is possible because Microsoft's software is full of undocumented features. Since both companies are making money by selling
software development tools I won't be surprized if Microsoft simply didn't release some technical details to Intel, even if there is a cooperation
between these two companies.

This is a follow up...

Quoting tpuckeWe have tracked down an intellisense issue (Visual Studio) to the __INTEL_COMPILER macro not being visible to the intellisense processor...
I confirm that __INTEL_COMPILER macro is not visible withVisual Studios 2005, 2008 and 2010.

However, a simple workaround could be used:

...
#define _RT_INTEL_COMPILER __INTEL_COMPILER
...

The_RT_INTEL_COMPILER macrois visible to IntelliSense. It isverified with Visual Studio 2005 and Intel C++ Composer XE 2011.

Best regards,
Sergey

For this specific predefined macro "__INTEL_COMPILER", the VS intellisense will understand it with Intel C++ Composer XE 13.0's integration. But only this one predefined macro though.

Jennifer

That's great, thanks for the follow up.

Quoting Jennifer Jiang (Intel)For this specific predefined macro "__INTEL_COMPILER", the VS intellisense will understand it with Intel C++ Composer XE 13.0's integration. But only this one predefined macro though.

Jennifer

Thank you, Jennifer!

Leave a Comment

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