- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I think predefined macro should do the trick.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I think predefined macro should do the trick.
You may use -std:c++0x compiler option to to get support for C++0x. It is best to leave the internal details to driver implentor.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You may use -std:c++0x compiler option to to get support for C++0x. It is best to leave the internal details to driver implentor.
#ifndef __cplusplus0x
#error C++0x compiler required.
#endif
MSVC has predefined macro __cplusplus, which is defined for c++ programs only.
It would be nice to have __cplusplus0x macro, which is defined for c++0x programs only (when -std:c++0x specified).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
#ifndef __cplusplus0x
#error C++0x compiler required.
#endif
MSVC has predefined macro __cplusplus, which is defined for c++ programs only.
It would be nice to have __cplusplus0x macro, which is defined for c++0x programs only (when -std:c++0x specified).
you may try macro __GXX_EXPERIMENTAL_CPP0X__ on linux.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
#ifndef __cplusplus0x
#error C++0x compiler required.
#endif
MSVC has predefined macro __cplusplus, which is defined for c++ programs only.
It would be nice to have __cplusplus0x macro, which is defined for c++0x programs only (when -std:c++0x specified).
you may try macro __GXX_EXPERIMENTAL_CPP0X__ on linux.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You may use compiler option /QdM to get the defined macros:
icl /QdM /E hello.cpp > diag1.txt
icl /Qstd:c++0x /QdM /E hello.cpp > diag.txt
Find out the difference id diag1.txt and diag.txt and use the information appropriately. In my experiment I found macro _MSC_EXTENSIONS is missing when using /Qstd:c++0x.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You may use compiler option /QdM to get the defined macros:
icl /QdM /E hello.cpp > diag1.txt
icl /Qstd:c++0x /QdM /E hello.cpp > diag.txt
Find out the difference id diag1.txt and diag.txt and use the information appropriately. In my experiment I found macro _MSC_EXTENSIONS is missing when using /Qstd:c++0x.
This behaviour is not guaranteed, but it works at least.
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You may use compiler option /QdM to get the defined macros:
icl /QdM /E hello.cpp > diag1.txt
icl /Qstd:c++0x /QdM /E hello.cpp > diag.txt
Find out the difference id diag1.txt and diag.txt and use the information appropriately. In my experiment I found macro _MSC_EXTENSIONS is missing when using /Qstd:c++0x.
While this trick might work for the moment, still a better, more reliable solution is very desirable. Does someone know if a macro to recognize partial C++0x support is going to be provided in future versions of Intel Compiler?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
While this trick might work for the moment, still a better, more reliable solution is very desirable. Does someone know if a macro to recognize partial C++0x support is going to be provided in future versions of Intel Compiler?
Weareunaware ofthe Intel's current plan. You may submit the feature request to Intel premier support at http://premier.intel.com.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Greetings, I have the very same problem since I need to detect _Pragma at preprocessor time.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Depending on what you wish to do, it's problematical, as you need to set icpc -std=c++11 and have a g++ on PATH which also accepts that option. If you don't have both of these, you won't get anywhere with compilation with the option set.
You might do something with scripts using g++ -v and icpc -V to check version numbers, or possibly with autoconf, to check the versions without setting -std, then redo with -std=c++11 set.
On Windows, you could check compiler versions likewise; ICL 13.0 and newer use /Qstd=c++11 to invoke the partial C++-11 of Intel C++; using VS2010 or 2012 the apparently lesser degrees of C++11 support by the Microsoft CL are present with ICL 12.0 and newer without /Qstd.
g++ had some c++11 features turned on without the option for which icpc required the option to be set.
see http://software.intel.com/en-us/articles/c0x-features-supported-by-intel-c-compiler
It's difficult to assess the varying degrees of partial support you will find among those compilers.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm not sure that without a message to C++11 architects / designers something could be done ( I wouldn't accuse vendors of C++ compilers ). However, simple workarounds at a compile time could be used and I follow up on that next week with as much as possible technical detsils.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You are supposed to use the value of the macro __cplusplus. G++ 4.7 and later set the value to 201103L. Microsoft has not yet changed the value (it's still set to199711L since they are still pretty far away from being c++11 standard compliant. I think what would be really useful are separate macros which would tell the user which c++11 (or c++14) features are implemented (these are called "feature macros"). A proposal is currently being worked on by the C++ committee to do that.
Judy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In the case of emitting a #error and stopping compilation, can you not include a declaration with an appropriate name that requires the desired feature.
static auto _WeRequireCPP11 = [](){returm;};
Or something like that.
If you want the preprocessor to support this for different code generation, then you could define your own macro and include the "assert" above to assure the compiler actually supports the feature and/or compiler option selected.
Jim Dempsey
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page