
C++11 compiler support shootout: Visual Studio, GCC, Clang, Intel - shin_lao
http://cpprocks.com/c11-compiler-support-shootout-visual-studio-gcc-clang-intel/
======
agwa
> It looks like GCC is overtaking Clang as the compiler with the best C++11
> support

There seems to be a myth going around that Clang has or had better C++11
support. Apparently when the author did his last shootout Clang had a slight
edge over GCC, but over the long run GCC has had the better support most of
the time. I started using C++11 (or C++0x as it was still called) in February
2011 and at that time GCC 4.5 had significantly better support than Clang.

Not to denigrate Clang's other qualities - I wanted Clang's better error
messages but had to stick with GCC to get the C++0x support I needed.

~~~
jevinskie
GCC 4.8 has caret-denoted column information for errors and warnings.

~~~
agwa
That's awesome. I'm glad to see that the healthy competition is making GCC
improve.

------
agentultra
C++11 rocks and I think Bjarne was right in saying that it feels like a new
language. This isn't your grand-daddy's C++. It's certainly worth considering
for your next project and valuable to learn if only to make you a better
programmer.

~~~
angersock
See, the funny thing is, you're still going to be interfacing with your grand-
daddy's C++, and _his_ daddy's C. And you'll be adding cruft for your grandki
--ah, who am I kidding, hopefully they'll be using Ruby.

EDIT: Downvote all you want--you know it's true. It is seldom you'll get to
write a new C++ project from scratch, totally, using only standard libraries.

~~~
marshray
/me goes off to play with his new C++11 project.

~~~
angersock
Anything interesting?

~~~
marshray
Not yet. :-)

It's stuff like <https://github.com/marshray/qak> in which I indulge my
impulse to recreate the universe from scratch in C++11 on the weekends so I
don't act foolishly during the week.

I've been porting it to the limitations of MSVC 2012 and looking at
implementing a lightweight Node.js-like IO system in C++11.

------
delinka
A bit off-topic, but since I discovered Intel's compiler years ago, I've been
wondering why I, the generic desktop programmer, would want to pay for a
compiler when the free ones are pretty damn good. I can think of only a small
set of use cases where the CPU manufacturer might know the best optimization
for some code that's heavily utilized in compute-intensive projects, but that
seems like a small market.

~~~
JoeAltmaier
Intel's compiler generates code that runs twice as fast. Speed should really
have been in the list.

On that note, the whole list looks like it was written from the point of view
of gcc. Features on other compilers that vary from gcc are given 'partial'
credit, since I guess they do it differently and different is bad. And
extensions in other compilers are not mentioned at all.

It looks like the 'shootout' was done by standing in gcc's corner and taking
pot-shots at everybody else in the room.

~~~
rayiner
Only in relatively rare cases where ICC can auto vectorization and gcc can't.
Otherwise, very comparable on 64-bit:
<http://willus.com/ccomp_benchmark2.shtml?p17>

------
alecthomas
I recently wrote an entity-component framework [1] for C++ using a bunch of
C++11 and it was really quite enjoyable. At the time, VC++ didn't support
variadic templates which was a bummer, but they've since released a feature
pack with it. It's great to see adoption coming along so quickly.

[1] <https://github.com/alecthomas/entityx>

~~~
scott_s
What new parts of C++ did you appreciate the most?

~~~
ajross
Not the OP, but I'm going to put my vote down for a simple and comparatively
less discussed feature: initializer lists. Declarative programming is a huge
win, and being able to declare objects just like you do "static data" is a
huge readability win.

Other stuff is mostly about fixing bugs in the standard (<cough> rvalue
references </cough>), cleaning up the syntax (auto) or providing new syntax
for useful but comparatively rare operations (lambdas). That's all good, but
initializer lists can change the paradigm of how the code is presented, and
that's better.

~~~
pmelendez
"useful but comparatively rare operations (lambdas)"

I think it is rare just because people is not used to it, once they discover
the flexibility of lambdas functions you would start seeing them more often
(even abuse of them)

I am remaking a event system that I did for a turn based card game and the use
of lambdas is just so natural that I realized now how painful and weak was the
previous code.

~~~
ajross
Lambda functions are just syntax, they aren't "flexible" in any meaningful way
I can see. And I argue that they certainly are rare -- virtually all major
languages (other than C and C++03) have some form of straightforward anonymous
function with some form of local scope closure (and to be clear: C++11's
implementation of that bit is sort of a mess!).

Other than node.js, virtually none of them make regular use of them. When they
do, it's mostly just to have a convenient way of passing a callback.

Lambda's are good. But as implemented in C++11 they really don't do anything
to change the nature of the code being written. On the other hand, proper use
of initializers _does_ , by virtue of _not_ having to write a thousand
setXXX() functions, etc...

~~~
scott_s
For me, the lack of lamba functions meant I was less likely to use many of the
algorithms from the standard library. In general, you want to provide a
functor to such functions, and it doesn't make sense to define a class,
overload operator(), and get the member variables and instantiations to line
up when you could just write a for loop. With lambdas, the compiler will do
that boiler plate for me.

(Yes, I say "will" - I'm not yet working on something that lets me use C++11
features. Sigh.)

~~~
pjmlp
This is what a like about C++11, it feels a safer language and lets me do lots
of functional style programming.

Sadly I am stuck in JVM/.NET on the day job.

------
nicholassmith
GCC guys have been on a tear getting the support built in, but it's nice to
see Microsoft is slowly catching up as well.

------
Keyframe
Shame about C99 support. I'm afraid to even ask about C11.

~~~
pjmlp
C99 is probably going to be the last C standard most commercial compiler
vendors will care about.

On the desktop and server the world is moving from C to C++/Objective-C, with
C still being very important in the embedded space.

Microsoft's official position is C++ is the future and C is legacy on Windows
platforms.

Even the two most important open source C and C++ compilers are now both
written in C++, although given their open source nature, I expect they to keep
on supporting C contrary to the commercial vendors.

~~~
ori_b
C11 language support seems to be complete since GCC 4.7.

~~~
pjmlp
My main point was about commercial compiler vendors.

~~~
ori_b
Intel's C compiler also claims to support most of C11, as, apparently, does
Clang. That covers the popular Unix compilers. Microsoft seems to be the big
outlier, but they don't even care about C99.

I admit, though, I have no idea what commercial compilers are popular in the
Windows world. I am under the impression that you either used Intel's
compiler, Microsoft's compiler, or a free port of the Unix toolchain, but I
don't really do Windows development.

~~~
pjmlp
You left out all the big commercial UNIX vendors, embedded market, real time
operating systems, HPC and game development.

~~~
ori_b
HPC is usually one of IBM XLC, Intel ICC, or GCC. All of them support most or
all of the C11 language features.

For commercial unixes, it's hard to find documentation on C versions supported
by Oracle Solaris Studio, but it was last released in 2011. HPUX ACC was last
released in 2010, so I would be very surprised if it supported the 2011 C
standard already. That doesn't meant it won't, but it does mean that it moves
slowly. Not surprising, since large unix vendors operate in a market where
stability is valued above most other things. IBM XLC already supports C11.

The embedded market tends to use GCC, from what I can tell, although it may
vary widely by company. ArmCC _is_ around, but the last major looks like it
was in 2011 (minor updates since). I don't know what future versions will
bring, but I'd be surprised if they don't at least end up supporting the
memory model and atomics. These are /useful/ when writing embedded code.

RTOS development is pretty much the same situation as embedded.

From what I understand, game development usually isn't done in C, but I'd be
very curious to know how the compilers there differ from compilers used for
normal desktop applications. Which ones are normally used for game
development?

EDIT: And, apparently, Microsoft is going to be adding _some_ C11 features to
C, as well as most of C99, because it will be piggybacking off the C++11
updates. So even the company that said it was ignoring anything newer than C90
is adding C11 features. That was a surprise to me.

Perhaps you could list some widely used compilers that have said they will not
be moving towards C11 support?

~~~
binarycrusader

      For commercial unixes, it's hard to find documentation on C versions supported by Oracle Solaris Studio, but it was last released in 2011. HPUX ACC was last released in 2010, so I would be very surprised if it supported the 2011 C standard already. That doesn't meant it won't, but it does mean that it moves slowly. Not surprising, since large unix vendors operate in a market where stability is valued above most other things. IBM XLC already supports C11.
    

While it's true the last release was in Dec. 2011, Solaris Studio receives
updates and fixes (just as Visual Studio, etc.) do between releases that may
contain significant improvements.

As for standards conformance, I "googled" it:

    
    
      http://docs.oracle.com/cd/E24457_01/html/E21990/bjabb.html
    

C11 and C++11 support are not yet available in any form, although the Solaris
Studio compiler is one of the few that actually has _full_ C99 compliance
(yes, even those annoying floating point pragamas).

Support for C++11 is planned though:

    
    
      https://forums.oracle.com/forums/thread.jspa?messageID=10730210

------
msvan
Why is it that Microsoft seems to lag so far behind? Don't they have lots of
funds and competent programmers to take the lead? Or is it simply not a
priority?

~~~
stuffandthings
On the MSVC blog, there's a post announcing C++11 support in VS2012. The
comments, of course, are filled with angry devs posting about what a joke the
initial VS2012 support is.

Buried in those comments is one from a MS dev who claims that he is the _only_
guy working on the standard library implementation. Kinda sad, really.

~~~
danieldk
_Buried in those comments is one from a MS dev who claims that he is the only
guy working on the standard library implementation._

Doesn't Microsoft license its standard library from Dinkumware?

<http://dinkumware.com/>

------
qompiler
> I’m also going to omit Intel’s library from this comparison.

Without a reason?

~~~
xyzzy123
With icc you usually use libstdc++ (mac/linux) or the MSVC C++ libraries
(windows).

------
known
Hope they'd not break <http://en.wikipedia.org/wiki/Standard_Template_Library>
and <http://en.wikipedia.org/wiki/Boost_%28C%2B%2B_libraries%29> based
applications

------
fafner
I wonder why libstdc++ development is so slow. Regex support has been missing
since TR1.

~~~
alecthomas
I can't be sure, but the fact that libstdc++ is ABI incompatible with the
current stdlib probably doesn't help adoption and thus usage and testing. If
you want to use libstdc++ _every_ dependency must also be compiled against it,
including any system packages.

~~~
plorkyeran
libstdc++ != libc++

libstdc++ is gcc's C++ stdlib; libc++ is clang's (although clang can used
libstdc++). libc++ supports all of C++11, although there's still some bugs.
libc++ is ABI incompatible with libstdc++, but it's explicitly designed to
support using both libstdc++ and libc++ within the same program, so that's
often not a program.

~~~
alecthomas
Sorry, rereading my post I realise I omitted some text (I was on my phone),
and shouldn't have said "ABI incompatible". What I meant to say was that the
C++11 versions of both libstdc++ [1] and libc++ [2] are effectively
incompatible with the C++98 version of libstdc++. The main point still stands:
you effectively can not link against libraries using different versions of the
C++ standard unless you're very lucky.

[1] <http://gcc.gnu.org/wiki/Cxx11AbiCompatibility> [2]
[http://stackoverflow.com/questions/12542971/using-libstdc-
co...](http://stackoverflow.com/questions/12542971/using-libstdc-compiled-
libraries-with-clang-stdlib-libc)

------
dschulz

        s/Yes/✔/g
        s/No/✘/g
        s/Partial/∂/g
        s/Don't know/?/g

