LWN: Comments on "GCC 4.8.1 released" https://lwn.net/Articles/552708/ This is a special feed containing comments posted to the individual LWN article titled "GCC 4.8.1 released". en-us Sat, 11 Oct 2025 02:54:08 +0000 Sat, 11 Oct 2025 02:54:08 +0000 https://www.rssboard.org/rss-specification lwn@lwn.net ABI stability https://lwn.net/Articles/553353/ https://lwn.net/Articles/553353/ luto <div class="FormattedComment"> I can't argue with that. Perhaps I'll even submit such a proposal to add such an attribute (and libstdc++ can ignore it unless it comes in handy for new C++17 classes).<br> </div> Sat, 08 Jun 2013 00:46:38 +0000 ABI stability https://lwn.net/Articles/553351/ https://lwn.net/Articles/553351/ jwakely <div class="FormattedComment"> But I can't see any reason to replace working code that uses empty bases with code using such an attribute, because that attribute might not work in C++98 mode anyway and the existing code has to keep working. The simplest way to not break the ABI is not change working code!<br> </div> Fri, 07 Jun 2013 23:44:13 +0000 ABI stability https://lwn.net/Articles/553338/ https://lwn.net/Articles/553338/ luto <blockquote>I don't think libstdc++ has any need for empty member support, I'm not sure the language needs it either.</blockquote> As far as I know, it's always possible to replace member variables with inheritance, but IMO it's somewhere between ugly and insanely ugly. <p> Writing "Allocator [[allow_empty]] a;" would be prettier and a lot less verbose than using fancy empty-base-optimized tuples, not to mention easier to deal with in gdb. Fri, 07 Jun 2013 21:24:06 +0000 ABI stability https://lwn.net/Articles/553327/ https://lwn.net/Articles/553327/ jwakely <div class="FormattedComment"> Well duh. If [programmers didn't introduce bugs] there wouldn't be the need to fix [them]. Thanks for the newsflash.<br> <p> And I cannot parse a sentence containing both "on IA64" and "important things" ;)<br> </div> Fri, 07 Jun 2013 19:45:11 +0000 ABI stability https://lwn.net/Articles/553326/ https://lwn.net/Articles/553326/ jwakely <div class="FormattedComment"> Yes, there's a new attribute to allow magical versioning, so that std::string in C++11 mode will mangle differently (and so will any type or function using it, which makes it solve the problem properly, unlike inline namespaces.)<br> <p> I don't think libstdc++ has any need for empty member support, I'm not sure the language needs it either.<br> </div> Fri, 07 Jun 2013 19:36:17 +0000 ABI stability https://lwn.net/Articles/553324/ https://lwn.net/Articles/553324/ luto <div class="FormattedComment"> Is there a path forward to make this kind of change (e.g. getting rid of ref-counted strings) either by breaking things one day or by some highly magical use of versioning?<br> <p> Also, what happens if/when C++ gets real empty member support (e.g. "T [[allow_empty]] allocator" or whatever other ideas might be floating around)? Can libstdc++ start using these in a way that won't change the ABI?<br> </div> Fri, 07 Jun 2013 18:19:52 +0000 ABI stability https://lwn.net/Articles/553319/ https://lwn.net/Articles/553319/ khim <blockquote><font class="QuotedText">If GCC didn't break ABI compatibility there wouldn't be the need to fix it in GCC point releases.</font></blockquote> <p>True, but what does it change? You can say the same about Android, GLibC, Linux, Windows or any other project which is serious about ABI compatibility.</p> <blockquote><font class="QuotedText">This past experience is why the C++ library that I'm responsible for at work is built for each customer's particular Linux distribution rather than trying to build one binary that works for everybody.</font></blockquote> <p>It's your choice but it does not prove anything. Somehow others can build one binary and it works just fine. I've seen problems with many libraries but libstdc++ was never a problem. It's certainly possible to build libstdc++ in a fashion which will make it incompatible, but most major distributions carry LSB-compatible libstdc++ and work just fine with a single binary.</p> Fri, 07 Jun 2013 17:46:27 +0000 GCC 4.8.1 released https://lwn.net/Articles/553313/ https://lwn.net/Articles/553313/ jzbiciak <div class="FormattedComment"> That sounds like a good strategy. C++11 is a huge leap over C++98. I have to agree with Stroustrup's statement that it feels like a new language. It's sufficiently disruptive that I personally mentally treat C++11 code as a different language than C++98, and am holding off on writing C++11 until more compilers support it.<br> <p> These finer grain updates sound much less disruptive.<br> <p> And reading up on that "trivial little thing called concepts": That looks very useful, but feels like the kind of feature that would ripple to all corners of the language, or at least all the corners of the standard library. Probably a good thing it is on a parallel track that won't hold up a specific refresh of the C++ standard. <br> </div> Fri, 07 Jun 2013 16:54:26 +0000 GCC 4.8.1 released https://lwn.net/Articles/553307/ https://lwn.net/Articles/553307/ jwakely <div class="FormattedComment"> I thought it was meant in jest, but the committee is *really* keen that C++14 doesn't become C++19, because that would cause all sorts of scheduling problems for C++17 ;-)<br> <p> The larger changes (e.g. filesystem library, networking library, a trivial little thing called concepts) are being done as separate "Technical Specification" documents so they can happen on separate schedules that are independent of approving a new standard.<br> </div> Fri, 07 Jun 2013 14:52:33 +0000 GCC 4.8.1 released https://lwn.net/Articles/553279/ https://lwn.net/Articles/553279/ jzbiciak <div class="FormattedComment"> That good, then. <br> <p> Please ignore my failed attempt at tongue in cheek humor.<br> </div> Fri, 07 Jun 2013 13:47:48 +0000 GCC 4.8.1 released https://lwn.net/Articles/553276/ https://lwn.net/Articles/553276/ jwakely <div class="FormattedComment"> No, I meant what I said.<br> <p> The Bristol meeting in April was the deadline for new features to be added to C++14.<br> </div> Fri, 07 Jun 2013 13:31:17 +0000 GCC 4.8.1 released https://lwn.net/Articles/553257/ https://lwn.net/Articles/553257/ jzbiciak <BLOCKQUOTE><I>there's nothing as complicated as <TT>&lt;regex&gt;</TT> or UTF8 code conversion facets in C++14.</I></BLOCKQUOTE> <P>...yet.</P> Fri, 07 Jun 2013 03:23:10 +0000 ABI stability https://lwn.net/Articles/553213/ https://lwn.net/Articles/553213/ zlynx <div class="FormattedComment"> If GCC didn't break ABI compatibility there wouldn't be the need to fix it in GCC point releases.<br> <p> I don't have an example to point to right this instant but I have definitely hit serious C++ ABI bugs in the past while running Gentoo. I updated to GCC 4.something and older C++ programs started segfaulting.<br> <p> Not to mention that on IA64 important things like exception handlers would just fail to catch exceptions every other GCC version.<br> <p> This past experience is why the C++ library that I'm responsible for at work is built for each customer's particular Linux distribution rather than trying to build one binary that works for everybody. It's also why everything is hidden behind a private implementation pointer and there is NO USAGE of anything inline in the includes.<br> </div> Thu, 06 Jun 2013 19:27:41 +0000 ABI stability https://lwn.net/Articles/553016/ https://lwn.net/Articles/553016/ nix <div class="FormattedComment"> ISTR a C ABI change in some non-x86 arch's representation of bitfields (was it SPARC though? Don't think so). However... as widely-used parts of the ABI go, that's not one.<br> <p> </div> Wed, 05 Jun 2013 19:51:33 +0000 GCC 4.8.1 released https://lwn.net/Articles/552945/ https://lwn.net/Articles/552945/ jwakely <div class="FormattedComment"> <font class="QuotedText">&gt; I never really trusted non-allocator-aware containers to acutally copy a as opposed to doing a rebind and default-constructing a new one,</font><br> <p> But GCC's containers have *always* got that right, that can be verified easily if you cared to.<br> <p> <font class="QuotedText">&gt; since pre-C++11 allocators were pretty much intended to be stateless AFAICT.</font><br> <p> No, containers were allowed to assume allocators were stateless, but the intention was to support stateful ones, the standard specifically said so: "Implementors are encouraged to supply libraries that can accept allocators that encapsulate more general memory models and that support non-equal instances." And indeed most implementations had some support for stateful allocators.<br> <p> I suspect what you want doesn't depend on the allocator-aware requirements, so if you'd wanted it that badly for years you could have done it.<br> <p> I also suspect the many hours I've spent implementing the allocator-aware requirements have been a massive waste of my time :-\<br> </div> Wed, 05 Jun 2013 10:07:02 +0000 GCC 4.8.1 released https://lwn.net/Articles/552936/ https://lwn.net/Articles/552936/ jmalcolm <div class="FormattedComment"> <font class="QuotedText">&gt;&gt; Only on MacOS, though.</font><br> <p> Work on libc++ may be lagging on Linux and Windows but libc++ is at least not Apple only.<br> <p> FreeBSD lists the status of libc++ as "Works on -CURRENT, passing more tests than on Darwin". Darwin is Apple.<br> <p> I think Clang/libc++ are scheduled to become the default tool-chain in FreeBSD 10.<br> <a rel="nofollow" href="https://wiki.freebsd.org/BSDToolchain">https://wiki.freebsd.org/BSDToolchain</a><br> <p> <p> </div> Wed, 05 Jun 2013 06:11:05 +0000 GCC 4.8.1 released https://lwn.net/Articles/552922/ https://lwn.net/Articles/552922/ luto <div class="FormattedComment"> Mainly paranoia. It's easy enough to do:<br> <p> TrivialAllocator a;<br> std::map&lt;T, U, TrivialAllocator&gt; m(a);<br> <p> and then accidentally copy or move m, causing memory corruption. (Also, I never really trusted non-allocator-aware containers to acutally copy a as opposed to doing a rebind and default-constructing a new one, since pre-C++11 allocators were pretty much intended to be stateless AFAICT.)<br> </div> Wed, 05 Jun 2013 01:38:26 +0000 GCC 4.8.1 released https://lwn.net/Articles/552921/ https://lwn.net/Articles/552921/ jwakely <div class="FormattedComment"> The reason I ask is that you can already use stateful allocators and scoped_allocator_adaptor with set/map, what's missing is using allocator_traits (which simplifies writing allocators but isn't essential for most purposes) and allocator propagation (which I wouldn't think is very relevant for short-lived objects) and the additional constructors needed for nested containers using the scoped allocator model. Many other uses work already - what are you missing so yours would work?<br> </div> Wed, 05 Jun 2013 01:06:34 +0000 GCC 4.8.1 released https://lwn.net/Articles/552918/ https://lwn.net/Articles/552918/ jwakely <div class="FormattedComment"> Which specific features do you need that are missing from GCC's set/map? Does Boost.Container provide those features?<br> </div> Wed, 05 Jun 2013 00:21:00 +0000 GCC 4.8.1 released https://lwn.net/Articles/552894/ https://lwn.net/Articles/552894/ luto <div class="FormattedComment"> I've been wanting something like allocator-aware set and map for years so that I can use a trivial, fast non-thread-safe allocator for short-lived data structures.<br> <p> Possibly no one uses them because almost nothing supports them yet.<br> </div> Tue, 04 Jun 2013 18:56:57 +0000 GCC 4.8.1 released https://lwn.net/Articles/552883/ https://lwn.net/Articles/552883/ jakub@redhat.com <div class="FormattedComment"> The announcement meant core language C++11 feature completeness of a released compiler.<br> But even checking in VCS, clang was feature complete April 19th with<br> <a rel="nofollow" href="http://www.llvm.org/viewvc/llvm-project?view=revision&amp;revision=179858">http://www.llvm.org/viewvc/llvm-project?view=revision&amp;...</a><br> with various follow-ups needed for that,<br> g++ ref-specifiers were completed with:<br> <a rel="nofollow" href="http://gcc.gnu.org/r197437">http://gcc.gnu.org/r197437</a><br> <a rel="nofollow" href="http://gcc.gnu.org/r197387">http://gcc.gnu.org/r197387</a><br> <a rel="nofollow" href="http://gcc.gnu.org/r197318">http://gcc.gnu.org/r197318</a><br> (i.e. roughly April 1st-3rd), also some follow-up bugfixes.<br> </div> Tue, 04 Jun 2013 17:35:28 +0000 ABI stability https://lwn.net/Articles/552831/ https://lwn.net/Articles/552831/ jwakely <div class="FormattedComment"> To answer your question directly: the ABI is entirely stable for C++03 code. Any ABI breakage for C++03 code is a serious bug. If the ABI wasn't required to be stable we'd have switched to a non-ref-counted std::string years ago and fixed numerous other known issues (and hacking on libstdc++ would be a lot more fun!)<br> <p> If you use C++11 then in general you can combine C++11 code built with GCC 4.X and C++03 code built with any GCC, but there is not the same guarantee that you can combine with C++11 code built with GCC 4.Y or GCC 4.Z, because the C++11 features are not all stable yet (e.g. for GCC 4.9 I'm about to add a new virtual function to a base class in &lt;future&gt;.) This is why C++11 support is still labelled "experimental", because it would be worse to claim it's stable and then have to break the ABI.<br> </div> Tue, 04 Jun 2013 11:20:09 +0000 GCC 4.8.1 released https://lwn.net/Articles/552827/ https://lwn.net/Articles/552827/ jwakely <div class="FormattedComment"> I wouldn't be surprised if we implement all the new C++14 features before the missing C++11 ones, there's nothing as complicated as &lt;regex&gt; or UTF8 code conversion facets in C++14.<br> </div> Tue, 04 Jun 2013 11:04:37 +0000 ABI stability https://lwn.net/Articles/552824/ https://lwn.net/Articles/552824/ jwakely <div class="FormattedComment"> <font class="QuotedText">&gt; I don't think that is true in the general case, but correct me if I'm wrong. </font><br> <p> Someone should correct him for being wrong. Almost entirely wrong.<br> <p> <font class="QuotedText">&gt; I think they like to preserve ABI compatibility between all same point versions (e.g. 4.2.x),</font><br> <p> GCC 4.8's libstdc++ is backward-compatible all the way back to GCC 3.4 nine years ago, but why let a few facts get in the way when you can pontificate about a subject you once read something a long time ago and forgot the details.<br> <p> <font class="QuotedText">&gt; ABI compatibility between minor versions is desired but not required.</font><br> <p> 100% wrong.<br> <p> <p> <font class="QuotedText">&gt; I think Sun Sparc broke in one of the minor 4.x bumps (4.0 or 4.1), </font><br> <p> [Citation needed] (It might be true, but I'm not aware of it.)<br> <p> <font class="QuotedText">&gt; And I don't think they like to make any guarantees about the STL compatibility.</font><br> <p> 100% wrong.<br> <p> <font class="QuotedText">&gt; No, that is dependent on packaging managers/distros.</font><br> <p> Wrong, symbol versioning is used in the default configuration on GNU/Linux and Solaris (at least.)<br> <p> </div> Tue, 04 Jun 2013 10:51:35 +0000 GCC 4.8.1 released https://lwn.net/Articles/552822/ https://lwn.net/Articles/552822/ jwakely <div class="FormattedComment"> <font class="QuotedText">&gt; For example, it has allocator-aware containers and a non-refcounted string.</font><br> <p> Does anyone actually use allocator-aware containers though? In any case GCC 4.8 already has allocator-aware vector and forward_list, 4.9 already has allocator-aware unordered containers, and my local Git clone has allocator-aware associative containers, so we only need to do deque and list. We already have a non-refcounted string, we just need to enable it without affecting the C++03 ABI.<br> <p> <font class="QuotedText">&gt; The libc++ website is rather unclear on how one is supposed to use it on Linux, though. </font><br> <p> There's a reason for that: You're *not* supposed to use it on Linux.<br> <p> Linux support in libc++ is an afterthought with fewer resources than libstdc++ and no collaboration with the C library. I agree with khim, using libc++ on Linux makes no sense, except for messing about and experimenting for your own amusement.<br> <p> </div> Tue, 04 Jun 2013 10:36:24 +0000 ABI stability https://lwn.net/Articles/552811/ https://lwn.net/Articles/552811/ tbleher <blockquote>AFAIK for the default configuration the only ABI changes in a point release have been to revert ABI breakage, i.e. bugfixes to make the ABI *more* stable. The change in GCC 4.8.1 is backwards compatible for the default configuration.</blockquote> <p>So how stable is the C++ ABI in general? There was recently a thread on the openal list where several participants claimed that compiling a C++ program and then replacing libstdc++ with a newer version was not guaranteed to work (see e.g. <a rel="nofollow" href="http://opensource.creative.com/pipermail/openal-devel/2013-May/005990.html">this message</a>, <a rel="nofollow" href="http://opensource.creative.com/pipermail/openal-devel/2013-May/005986.html">start of thread</a>). This would make distributing pre-compiled C++ programs very hard.</p> <p>What does GCC guarantee in this regard?</p> Tue, 04 Jun 2013 07:36:59 +0000 GCC 4.8.1 released https://lwn.net/Articles/552809/ https://lwn.net/Articles/552809/ khim True, but there are different levels of non-feature-completeness. &lt;regex&gt;, in particular, was standartized six years ago. It's one thing to not support something brand-spanking-new, it's another thing not to support something many years old. Tue, 04 Jun 2013 06:18:58 +0000 GCC 4.8.1 released https://lwn.net/Articles/552797/ https://lwn.net/Articles/552797/ jengelh <div class="FormattedComment"> And whenever the committee comes up with a new version of the standard, it suddenly becomes non-feature-complete again :)<br> </div> Mon, 03 Jun 2013 23:17:10 +0000 GCC 4.8.1 released https://lwn.net/Articles/552781/ https://lwn.net/Articles/552781/ luto <blockquote>What will be the point? Apple dropped GCC support long ago and under Linux it makes no sense to use libc++ even with Clang, let alone GCC.</blockquote> <p> Why not? libc++ is, it seems, a considerably better STL implementation. For example, it has allocator-aware containers and a non-refcounted string. The downside is that things like Boost are probably annoying to rebuild against libc++. <p> The libc++ website is rather unclear on how one is supposed to use it on Linux, though. Mon, 03 Jun 2013 20:17:36 +0000 GCC 4.8.1 released https://lwn.net/Articles/552778/ https://lwn.net/Articles/552778/ jwakely <div class="FormattedComment"> I wouldn't like to speculate about feature-completeness, because it depends on volunteers with no fixed schedule.<br> </div> Mon, 03 Jun 2013 19:57:36 +0000 GCC 4.8.1 released https://lwn.net/Articles/552775/ https://lwn.net/Articles/552775/ khim <blockquote><font class="QuotedText">Clang 3.3 (due out soon) and libc++ will be the first true C++11 compiler/library.</font></blockquote> <p>Only on MacOS, though. Lots of C++11 features only work with libstdc++ under Linux.</p> <blockquote><font class="QuotedText">Apparently, you can use GCC with libc++ though. I have not tried it.</font></blockquote> <p>What will be the point? Apple dropped GCC support long ago and under Linux it makes no sense to use libc++ even with Clang, let alone GCC.</p> Mon, 03 Jun 2013 19:28:16 +0000 GCC 4.8.1 released https://lwn.net/Articles/552770/ https://lwn.net/Articles/552770/ rriggs <div class="FormattedComment"> There will be much rejoicing when that comes to pass.<br> <p> Does that imply that we are likely to see a feature-complete libstdc++ in that time frame? I'm less concerned about that since Boost provides the one major feature that is currently lacking -- &lt;regex&gt;.<br> </div> Mon, 03 Jun 2013 19:24:05 +0000 GCC 4.8.1 released https://lwn.net/Articles/552750/ https://lwn.net/Articles/552750/ jwakely <div class="FormattedComment"> I hope we can do it for GCC 4.9<br> <p> AFAIK for the default configuration the only ABI changes in a point release have been to revert ABI breakage, i.e. bugfixes to make the ABI *more* stable. The change in GCC 4.8.1 is backwards compatible for the default configuration.<br> <p> I have some more C++11 ABI changes I need to make, but they'll only be for GCC 4.9.0, not a point release.<br> </div> Mon, 03 Jun 2013 18:23:47 +0000 GCC 4.8.1 released https://lwn.net/Articles/552742/ https://lwn.net/Articles/552742/ jmalcolm <div class="FormattedComment"> Also, although GCC may be C++11 complete, libstdc++ (the standard library) is not. So, you cannot do full C++11 with the FSF stack.<br> <p> Clang 3.3 (due out soon) and libc++ will be the first true C++11 compiler/library.<br> <p> Apparently, you can use GCC with libc++ though. I have not tried it.<br> </div> Mon, 03 Jun 2013 18:04:22 +0000 GCC 4.8.1 released https://lwn.net/Articles/552747/ https://lwn.net/Articles/552747/ rriggs <div class="FormattedComment"> Any idea when the "experimental" label be dropped and the ABI declared stable? It's difficult to justify using C++11 for production code when ABI changes are made in a point release. Many developers will not consider Clang or GCC usable for C++11 until that happens.<br> </div> Mon, 03 Jun 2013 18:01:42 +0000 GCC 4.8.1 released https://lwn.net/Articles/552744/ https://lwn.net/Articles/552744/ jwakely <div class="FormattedComment"> Indeed, Clang have not yet made a release that supports C++11 thread_local variables, and last I checked even their SVN version only supported dynamic destruction of thread_local variables when using GCC 4.8's C++ runtime.<br> </div> Mon, 03 Jun 2013 17:42:06 +0000 GCC 4.8.1 released https://lwn.net/Articles/552743/ https://lwn.net/Articles/552743/ rahulsundaram <div class="FormattedComment"> Pretty sure the announcement refers to the release. Not what was checked into a vcs. <br> </div> Mon, 03 Jun 2013 17:36:26 +0000 GCC 4.8.1 released https://lwn.net/Articles/552740/ https://lwn.net/Articles/552740/ realnc <div class="FormattedComment"> AFAIK Clang got there first with C++11 support. Perhaps the announcer wasn't aware of this.<br> </div> Mon, 03 Jun 2013 16:58:41 +0000 GCC 4.8.1 released https://lwn.net/Articles/552719/ https://lwn.net/Articles/552719/ and <div class="FormattedComment"> <font class="QuotedText">&gt; Support for C++11 ref-qualifiers has been added to GCC 4.8.1, making G++ the first C++ compiler to implement all the major language features of the C++11 standard.</font><br> <p> Probably they mean the first _released_ compiler. CLang already claimed this a few months ago, although for their SVN version. I think it is a bit strange that the GCC guys added new features in a point release. Maybe they should consider doing feature releases more frequently. <br> </div> Mon, 03 Jun 2013 16:18:55 +0000