C++11 standard library on OSX

C++11 standard library on OSX

Hi,

As far as I understand, Intel C++ compilers don't come with their own library and use the system library. OSX comes with libc++ from the clang project and a very old version of the GNU libstdc++, so old that std::array is still in tr1. Unfortunately, libc++ does not provide (as far as I know) any way of bound  checking the [] operator on std::vector and std::array (I don't want to use .at as I want bound checking on only when I debug my code).

 

I have compiled gcc 4.9 on my machine that comes with a new version of libstdc++. Is there any way o using this library with the Intel compiler ?

Best regards,

Francois

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

 

Try this option:

-gxx-name=<name>
          name and location of g++ if not where expected

This should find the right headers and right libraries based upon the location of the g++ binary.
 

Judy

 

Judging by my experience on linux, you would need icpc 15.0 to work with g++ 4.9 or 4.10.  It should be sufficient to have that g++ set up in the environment before starting icpc, if your g++ is working in the same build environment as icpc.

Francois,

Please note that icc / icpc officially supports only libraries supported by Apple -- that is, libc++ and old libstdc++. Moreover, -gxx-name option (that, as Judy explained, lets you use some other version of libc++) will be removed from 16.0 compiler. This is a delibrate choice from our part -- to avoid potential problems and confusion with use of 3rd party C++ standard libraries that we haven't tested before releasing the compiler.

Andrey
 

Small correction from my previous message: -gxx-name option will be removed starting from 15.0 OS X compiler (to be released this year).

Andrey

Hi Andrey,

Thanks for the information. I guess that sadly, OSX won't be my platform for development. I still can't beleive why Clang people don't put an option to bound-check the [] operator for std::vector and std::array. Coming from the Fortran world where turning on/off bound checking is as simple as a compiler switch it seems to me that some C++ people miss the pain of C-arrays and unsecure pointer arithmetic. I'll try to go to Clang forums to ask for a change.

 

best regards,

Francois

 

PS : both GNU libstdc++ and Microsoft implementation allow to turn on bound checking. Libc++ is the only STL implementation that does not come with it.

Leave a Comment

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