C++ dialect

How do I know which dialect of C++ am I programming with(C++98, C++03, C++11 etc.)?
If this compiles, you're using C++11:
auto foo=[](){};

Otherwise, you're using C++98/C++03. There are no real practical differences between the two.
and how to know which c++ compiler has c++11? I dont see it anywhere and google doesnt realy help.
Recent versions of major compilers all support C++11 to varying degrees.
There is no compiler that supports it fully yet.
See this page for an overview:
http://wiki.apache.org/stdcxx/C++0xCompilerSupport
Ok, I might, just might have totaly messed up my c++. I updated my gcc compiler with a version 4.6., the last one was 3.(something), and now it won't let me include iostream! it says something about some constant expresions blablabla... Anywho, is it possible to DOWNGRADE my gcc?
I don't see why you would want to do that. Purge your installation, then install Code::Blocks or wxDevC++, install the latest MinGW and set the toolchain path to the newly installed compiler.

http://www.codeblocks.org/downloads
http://forums.codeblocks.org/index.php?topic=15945.0

http://wxdsgn.sourceforge.net/

http://tdm-gcc.tdragon.net/download
yes, but it seems that gcc that supports c++11 doesn't support iostream! And i need iostream!
Of course it supports iostream. You just messed up something in your compiler setup or the path settings.
I just went to the defount "look for upgrades" options, clicked gcc v. 4.6.2, and installed it. there is no way I messed something up.
Oh, and I erased my whole previous c++ and reinstalled it and now it works
That information isn't very useful without knowing what IDE you use.
what's an IDE?
Oh, i looked it up. Ok, so it would be.. Bloodshed DEVC++ v. 4.9.9.2
It's what you call "c++". C++ is just a language specification, but to actually develop C++ applications, you need an IDE (consisting of an editor and all sorts of other tools) and/or a C++ compiler.

http://en.wikipedia.org/wiki/Integrated_development_environment
I just told you! I looked it up on wikipedia and tol you my IDE!
Last edited on
Yeah, see: http://www.cplusplus.com/articles/36vU7k9E/
Install one of the IDEs I mentioned or Eclipse CDT if you want to keep using g++.
> How do I know which dialect of C++ am I programming with(

The problem is that to be able to check than from within C++, you need a compiler that defines the preprocessor macro __cplusplus as specified by the appropriate IS. (for instance GCC 4.7).

if __cplusplus == 199711L then it is C++98
if __cplusplus == 201103L then it is C++11

1
2
3
4
5
6
#include <iostream>

int main()
{
    std::cout << __cplusplus << '\n' ;
}


> g++ -std=c++98 -pedantic -Wall -Werror test.cc && ./a.out
199711
> g++ -std=c++11 -pedantic -Wall -Werror test.cc && ./a.out
201103


In practice, the current level of C++11 feature support is partial and varies from compiler to compiler. Boost.Config would be quite handy if specific feature support needs to be checked.
http://www.boost.org/doc/libs/1_48_0/libs/config/doc/html/boost_config/boost_macro_reference.html

Last edited on
If I type std::cout << __cplusplus << '\n' ; it returns
1
!
what is that?
It is some sort of a C++ compiler all right, but:
Either: It is a pre-standard C++ compiler (before C++ had an International Standard)
Or: It is a compiler that does not define the preprocessor macro __cplusplus in accordance with the IS. (for example, GCC versions prior to 4.7)
Topic archived. No new replies allowed.