how to get the STL Library version used

P

Pallav singh

Hi All ,

how to get the STL Library version used by compiler ? is it linked to g
++ version ?

Thanks
Pallav singh
 
A

Alf P. Steinbach

* Pallav singh:
how to get the STL Library version used by compiler ? is it linked to g
++ version ?

There's no such thing in the standard.

The standard requires a macro __cplusplus that tells you that the compiler
implements the C++98 standard -- not very useful.

With the Dinkumware implementation of the standard library for Visual C++ you
have a macro _CPPLIB_VER that tells you which version of the Dinkumware headers
are used.

Perhaps some corresponding macro exists for g++.

In other words, read the documentation.

But the best advice is to not let your code depend on such knowledge.

If your code is correct, then if it compiles it should work, and if not then I
don't think there's any way to capitalize on version knowledge.


Cheers & hth.,

- Alf
 
J

James Kanze

* Pallav singh:

[...]
The standard requires a macro __cplusplus that tells you that
the compiler implements the C++98 standard -- not very
useful.

Especially as the standard doesn't have anything to say about
what a non-conforming compiler does. At least two widespread
"C++" compilers (g++ and VC++) defined __cplusplus without
implementing all of C++98, and of course, in pre-standard days,
all compilers which called themselves C++ defined __cplusplus,
without being anything similar to what we now know as C++.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,608
Members
45,244
Latest member
cryptotaxsoftware12

Latest Threads

Top