C++11 Compiler: Closest to the standard and how close?
There's a support matrix on the Apache wiki.
c++ compiler that supports all c++11 concurrency features?
Your best bet is too take a look at the support matrix from the Apache wiki as mentioned on C++11 Compiler: Closest to the standard and how close?. From there you will be able to see what compiler bet suits your needs.
Visual Studio
As mentioned from C++11 Features in Visual C++ 11 "In VC11, we intend to completely support the C++11 Standard Library, modulo not-yet-implemented compiler features."
GCC
C++0x/C++11 Support in GCC
Clang
C++98 and C++11 Support in Clang
Is C++11 widely supported?
Clang (updated regularly):
http://clang.llvm.org/cxx_status.html
GCC 4.5 to 4.7 (updated regularly):
http://gcc.gnu.org/projects/cxx0x.html
Visual C++ 10 and 11 (a bit old, but newest I've found):
http://blogs.msdn.com/b/vcblog/archive/2011/09/12/10209291.aspx
How to use C11 standard in Code::Blocks
Since the GCC 5.x versions run with -std=gnu11
by default, Code::Blocks must be doing something (such as passing -ansi
or -std=gnu90
) to the compiler to make it work differently.
Investigate all the options that are sent to the compiler. Find a way to have Code::Blocks show you the exact incantation it uses when compiling. Then work out how to fix it.
Options that are used are:
-Wall -Wextra -Werror -Wstrict-prototypes -Wconversion -std=gnu11 \
-O0 -g -ansi `pkg-config --cflags gtk+-3.0`
The -ansi
is doing the damage; it is equivalent to -std=c90
or perhaps -std=gnu90
— it explicitly undoes -std=c11
or -std=gnu11
.
How to activate c++11 standard in visual studio 2010?
std::thread
is obviously not in VS 2010. I think it was added with VS 2012, which is also supported by this question and answer. Is there any specific reason you're using 2010 rather than the latest version, 2013, which supports far more part of C++11?
Also to note: Contrary to GCC, MSVC doesn't have an "opt-in" for newer standards. It just supports them out of the box as far as implemented.
Is there any C compiler able to detect the violation of a strictly conforming program?
- Buffer overflow is undefined behavior.
- Therefore, this compiler must detect every possible buffer overflow in every possible program.
- Sounds too hard or impossible
- Sounds that such compiler does not exist :'(
What are the incompatible differences between C(99) and C++(11)?
If you start from the common subset of C and C++, sometimes called clean C (which is not quite C90), you have to consider 3 types of incompatibilities:
Additional C++ featues which make legal C illegal C++
Examples for this are C++ keywords which can be used as identifiers in C or conversions which are implicit in C but require an explicit cast in C++.
This is probably the main reason why Microsoft still ships a C frontend at all: otherwise, legacy code that doesn't compile as C++ would have to be rewritten.
Additional C features which aren't part of C++
The C language did not stop evolving after C++ was forked. Some examples are variable-length arrays, designated initializers and
restrict
. These features can be quite handy, but aren't part of any C++ standard, and some of them will probably never make it in.Features which are available in both C and C++, but have different semantics
An example for this would be the linkage of
const
objects orinline
functions.
A list of incompatibilities between C99 and C++98 can be found here (which has already been mentioned by Mat).
While C++11 and C11 got closer on some fronts (variadic macros are now available in C++, variable-length arrays are now an optional C language feature), the list of incompatibilities has grown as well (eg generic selections in C and the auto
type-specifier in C++).
As an aside, while Microsoft has taken some heat for the decision to abandon C (which is not a recent one), as far as I know no one in the open source community has actually taken steps to do something about it: It would be quite possible to provide many features of modern C via a C-to-C++ compiler, especially if you consider that some of them are trivial to implement. This is actually possible right now using Comeau C/C++, which does support C99.
However, it's not really a pressing issue: Personally, I'm quite comfortable with using GCC and Clang on Windows, and there are proprietary alternatives to MSVC as well, eg Pelles C or Intel's compiler.
How to enable C++11/C++0x support in Eclipse CDT?
I found this article in the Eclipse forum, just followed those steps and it works for me. I am using Eclipse Indigo 20110615-0604 on Windows with a Cygwin setup.
- Make a new C++ project
- Default options for everything
- Once created, right-click the project and go to "Properties"
- C/C++ Build -> Settings -> Tool Settings -> GCC C++ Compiler -> Miscellaneous -> Other Flags. Put
-std=c++0x
(or for newer compiler version-std=c++11
at the end . ... instead of GCC C++ Compiler I have also Cygwin compiler - C/C++ General -> Paths and Symbols -> Symbols -> GNU C++. Click "Add..." and paste
__GXX_EXPERIMENTAL_CXX0X__
(ensure to append and prepend two underscores) into "Name" and leave "Value" blank. - Hit Apply, do whatever it asks you to do, then hit OK.
There is a description of this in the Eclipse FAQ now as well: Eclipse FAQ/C++11 Features.
Eclipse setting
Visual Studio 2012 __cplusplus and C++ 11
This has already been submitted to Microsoft for review:
A value of predefined macro __cplusplus is still 199711L
Related Topics
Is There a Reason Why Not to Use Link-Time Optimization (Lto)
Recognize Open and Closed Shapes Opencv
Shift Image Content with Opencv
Print Template Typename at Compile Time
How to Speed Up Floating-Point to Integer Number Conversion
Is There a Reason to Use Enum to Define a Single Constant in C++ Code
How to Use C++ Modules in Clang
Compile Time String Encryption Using Constexpr
Difference Between File Scope and Global Scope
Reference to Non-Static Member Function Must Be Called
Setting Width in C++ Output Stream
Is There a Reason Declval Returns Add_Rvalue_Reference Instead of Add_Lvalue_Reference
Use #Ifdefs and #Define to Optionally Turn a Function Call into a Comment
Copy Constructor in C++ Is Called When Object Is Returned from a Function
What Are Differences Between Std, Tr1 and Boost (As Namespaces And/Or Libraries)