Chris Lattner
2013-Jan-09 02:30 UTC
[LLVMdev] Using C++'11 language features in LLVM itself
On Jan 8, 2013, at 4:24 PM, dag at cray.com wrote:> I am personally very much in favor of this. C++11 really is a huge leap > from C++03 in terms of readability, maintainability and safety.I agree completely.> Why not C++11 libraries? Implementation/capatability reasons? I don't > know anything about how the various implementation compare in terms of > completeness. But the libraries use the new language features and > theoretically you get a performance boost "for free."It's mostly about only changing one thing at a time. It's already possible to build LLVM in C++'11 mode and with a C++'11 library. Adding a dependency to *require* C++'11 compiler and/or C++'11 library are two orthogonal changes, and I'd like to tackle them one at a time.> I'm assuming we wouldn't release an llvm with C++11 until 3.4 at least > which gives folks a good 8 months to a year to prepare. Doing it in a > 3.3 release shortens that considerably but it might be ok. The biggest > issue for groups like ours is upgrading the compiler we use to build our > compiler. We have a LOT of components and they all have to work with > the new build environment. It involves a lot of testing and assurance > which is where we might bump up against a 3.3 release, not having a new > compiler in place before 3.3 is out. > > As for gcc version, it looks like 4.7.2 is in Debian Wheezy and that's > usually the most common distribution to lag behind in these kinds of > things. I think that's sufficiently new for Linux but someone correct > me if that's wrong.Wow, requiring GCC 4.7 would be really aggressive, it was just released in March 2012. Call me conservative, but I was thinking that a reasonable GCC baseline would be GCC 4.4 or something (which is ~3.5 years old). -Chris
Karen Shaeffer
2013-Jan-09 03:21 UTC
[LLVMdev] Using C++'11 language features in LLVM itself
On Tue, Jan 08, 2013 at 06:30:42PM -0800, Chris Lattner wrote:> On Jan 8, 2013, at 4:24 PM, dag at cray.com wrote: > > I am personally very much in favor of this. C++11 really is a huge leap > > from C++03 in terms of readability, maintainability and safety. > > I agree completely.> > > > As for gcc version, it looks like 4.7.2 is in Debian Wheezy and that's > > usually the most common distribution to lag behind in these kinds of > > things. I think that's sufficiently new for Linux but someone correct > > me if that's wrong. > > Wow, requiring GCC 4.7 would be really aggressive, it was just released in March 2012. Call me conservative, but I was thinking that a reasonable GCC baseline would be GCC 4.4 or something (which is ~3.5 years old).Hi, I was running Ubuntu 12.4, but I bumped up to 12.10. This was because 12.10 runs gcc-4.7.2. I have a reasonable code base that compiled fine in upgrading from 4.6(-std=c++0x) to 4.7.2(-std=c++11). IMO, with linux based systems, it is always safest to stay just a little off the bleeding edge. Bugs tend to get fixed very quickly, once identified. And then you have the advantage of the latest features. All things considered, I suspect all the energy is in 4.7.2 and forward in the context of C++ on linux for new implementations. I am also aware of the way too common problem of folks stuck in a time warp, because they have dependencies on old libraries that they cannot upgrade. IMO, a development effort should not slow the pace of feature adoption to support folks who have not planned for future upgrades in an intelligent manner. Rather than make everyone pay the price for such groups, there ought to be a way for them to use an older release of llvm until they figure out how to upgrade. I recommend targeting 4.7.2 or later, because all new C++ code on linux is surely going down that path. You can inconvenience the laggards, or you can turn away the folks leading the way with new implementations. But you can't satisfy both. Karen -- Karen Shaeffer Neuralscape, Mountain View, CA 94040
Joshua Cranmer
2013-Jan-09 04:23 UTC
[LLVMdev] Using C++'11 language features in LLVM itself
On 1/8/2013 8:30 PM, Chris Lattner wrote:> Wow, requiring GCC 4.7 would be really aggressive, it was just > released in March 2012. Call me conservative, but I was thinking that > a reasonable GCC baseline would be GCC 4.4 or something (which is ~3.5 > years old).On considering which versions get you various C++11 goodies, I'd personally recommend gcc 4.5 as the baseline: that's when you can start using lambdas and atomics (and a few other unicode goodies, but MSVC has yet to support those anyways, so the point is fully moot). Anything older than gcc 4.4 loses you most of the C++11 features. MSVC 2010 as the baseline precludes you primarily from the following features: * raw, user, unicode string literals * enum class [that's 2012] * alignment support * extra constructor features * explicit conversion operators * range-based for * intializer lists * constexpr -- Joshua Cranmer News submodule owner DXR coauthor
David Blaikie
2013-Jan-09 04:30 UTC
[LLVMdev] Using C++'11 language features in LLVM itself
On Tue, Jan 8, 2013 at 8:23 PM, Joshua Cranmer <pidgeot18 at gmail.com> wrote:> On 1/8/2013 8:30 PM, Chris Lattner wrote: >> >> Wow, requiring GCC 4.7 would be really aggressive, it was just released in >> March 2012. Call me conservative, but I was thinking that a reasonable GCC >> baseline would be GCC 4.4 or something (which is ~3.5 years old). > > > On considering which versions get you various C++11 goodies, I'd personally > recommend gcc 4.5 as the baseline: that's when you can start using lambdas > and atomics (and a few other unicode goodies, but MSVC has yet to support > those anyways, so the point is fully moot). Anything older than gcc 4.4 > loses you most of the C++11 features. MSVC 2010 as the baseline precludes > you primarily from the following features: > * raw, user, unicode string literals > * enum class [that's 2012] > * alignment support > * extra constructor features > * explicit conversion operators > * range-based for > * intializer lists > * constexprvariadic templates
greened at obbligato.org
2013-Jan-09 04:39 UTC
[LLVMdev] Using C++'11 language features in LLVM itself
Chris Lattner <clattner at apple.com> writes:> It's mostly about only changing one thing at a time. It's already > possible to build LLVM in C++'11 mode and with a C++'11 library. > Adding a dependency to *require* C++'11 compiler and/or C++'11 library > are two orthogonal changes, and I'd like to tackle them one at a time.Makes perfect sense, thanks.> Wow, requiring GCC 4.7 would be really aggressive, it was just > released in March 2012. Call me conservative, but I was thinking that > a reasonable GCC baseline would be GCC 4.4 or something (which is ~3.5 > years old).Whatever supports a reasonable set of C++11. I was just throwing out a strawman. Not even 4.6 supports template aliases and that's a rather nice feature. Still, it's not critical. Delegating and inheriting constructors fall under the same category, I think. Range-based for is not in 4.5 and I'd definitely want to have that. -David
greened at obbligato.org
2013-Jan-09 04:44 UTC
[LLVMdev] Using C++'11 language features in LLVM itself
Karen Shaeffer <shaeffer at neuralscape.com> writes:> I am also aware of the way too common problem of folks stuck in a time > warp, because they have dependencies on old libraries that they cannot > upgrade. IMO, a development effort should not slow the pace of feature > adoption to support folks who have not planned for future upgrades in > an intelligent manner. Rather than make everyone pay the price for > such groups, there ought to be a way for them to use an older release > of llvm until they figure out how to upgrade.That's pretty harsh. Vendors depend on other vendors. If suppliers don't offer a later version, then either the primary vendor has to implement a workaround or the primary vendor has to hold back. That's an important decision that comes up A LOT and the answer is different for every situation. People generally aren't stupid. They're doing what makes the most sense for them in their particular situation. I am of course speaking in generalities, not specifically to C++ libraries and compilers.> I recommend targeting 4.7.2 or later, because all new C++ code on > linux is surely going down that path. You can inconvenience the > laggards, or you can turn away the folks leading the way with new > implementations. But you can't satisfy both.4.7 doesn't actually have that many new language features than 4.6. I don't know about the std library, that may be quite different. I don't see a compelling reason to go to 4.7 quite yet. It might make more sense to go with 4.6 now and see how the 4.8 C++11 implementation looks when it arrives. -David
Óscar Fuentes
2013-Jan-09 11:03 UTC
[LLVMdev] Using C++'11 language features in LLVM itself
Chris Lattner <clattner at apple.com> writes:> Wow, requiring GCC 4.7 would be really aggressive, it was just > released in March 2012. Call me conservative, but I was thinking that > a reasonable GCC baseline would be GCC 4.4 or something (which is ~3.5 > years old).The feature intersection of GCC 4.4 and VS2010 leaves us with auto and static_assert.
Richard Osborne
2013-Jan-09 11:36 UTC
[LLVMdev] Using C++'11 language features in LLVM itself
On 09/01/13 02:30, Chris Lattner wrote:> Wow, requiring GCC 4.7 would be really aggressive, it was just released in March 2012. Call me conservative, but I was thinking that a reasonable GCC baseline would be GCC 4.4 or something (which is ~3.5 years old). > > -Chris > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdevWe build LLVM on Centos 5. AFAIK GCC 4.4 is the latest version available from the CentOS 5 repository (and it's the version we are currently using). -- Richard Osborne | XMOS http://www.xmos.com
Chris Lattner
2013-Jan-09 19:52 UTC
[LLVMdev] Using C++'11 language features in LLVM itself
On Jan 9, 2013, at 3:03 AM, Óscar Fuentes <ofv at wanadoo.es> wrote:> Chris Lattner <clattner at apple.com> writes: > >> Wow, requiring GCC 4.7 would be really aggressive, it was just >> released in March 2012. Call me conservative, but I was thinking that >> a reasonable GCC baseline would be GCC 4.4 or something (which is ~3.5 >> years old). > > The feature intersection of GCC 4.4 and VS2010 leaves us with auto and > static_assert.Ok, that's too minor to be worth the trouble. Would the intersection of GCC 4.5 VS2010 be practical? -Chris