News for hackers. Stuff that matters.
Re:C++ 20: The Core Language by w-m on Tuesday November 05, 2019 @12:50PM (#21454708)
On the other hand, there aren't really any changes in 14 and 17 that break compatibility with code written in 11, at least that I'm aware of.

In the examples I've seen it seems to mostly come down to compiler, toolchain and 3rd party binary availability for the new versions, like with any major language version.

If for example you are using stock gcc from Ubuntu 16.04 for your builds, you can't use C++17.

Re:C++ 20: The Core Language by Fronzie on Tuesday November 05, 2019 @01:08PM (#21454922)
For big (legacy) code-bases, just upgrading the compiler is a project by itself.

All 3rd party C++ libs need to be upgraded, all internal projects need to upgrade in an orderly fashion.

On top of that, just the change of the compiler will expose some pre-existing bugs.The bugs might have been there, but are not a problem for the business if they currently don't show.

I've seen projects with a core team of half a dozen people, supported by the other SW engineers working for 6 months just to upgrade to a newer version of windows and the compiler. This was mostly due to unwise SW-design decisions accumulated over 15+ years.

Re:C++ 20: The Core Language by jandrewrogers on Tuesday November 05, 2019 @01:46PM (#21455348)
You raise a good point about newer compilers doing much deeper analysis of the code than older compilers. I have experienced the horror of compiling an old, nominally clean C++11 code base with the latest version of clang++ and seeing a small avalanche of errors and warnings that weren't picked up by the compiler when that code was written.

It creates a lot of work, and frequently the nature of the bugs are not material (i.e. in context they may not produce a runtime fault), but I do find it to be good hygiene. I used to do builds with two different compilers for the same purpose, though that found compiler bugs as often as it found issues in the code.

Re:C++ 20: The Core Language by w-m on Tuesday November 05, 2019 @01:19PM (#21455057)
I totally agree, updating compilers is painful, and can be hard even for smaller projects. But for projects that went through that and actually got the newer compiler working with the C++11 code, I haven't yet seen anything that breaks compilation when then switching the compiler flag to C++14 mode.
Re:C++ 20: The Core Language by d1zzy on Tuesday November 05, 2019 @03:10PM (#21456135)
Plus, a lot of new library and language features are simply standardized versions of features that mature codebases had their own solutions for years, so "upgrading" to a newer C++ may also imply a long process of deprecating these alternatives in favor of standard ones, and the subtle differences between the two can expose new bugs and issues.
Re:C++ 20: The Core Language by cpeterso on Tuesday November 05, 2019 @03:34PM (#21456379)
Here is a list of some real-world examples of bugs that Mozilla had to fix when upgrading from Firefox from C++11 to C++14 to C++17 (still in progress). Many of these are compiler issues from upgrading to clang or gcc versions recent enough to support the new C++ versions, not C++ language changes.

https://bugzilla.mozilla.org/showdependencytree.cgi?id=15606...

Re:C++ 20: The Core Language by dgellow on Tuesday November 05, 2019 @04:51PM (#21457106)
Your link requires to be logged in to see the actual bug ticket.
Re:C++ 20: The Core Language by cpeterso on Wednesday November 06, 2019 @02:05AM (#21460355)
Oops. Sorry! Here is a different view of the bugs. I verified this list didn't require Bugzilla account.

https://bugzilla.mozilla.org/buglist.cgi?bug_id=1396098%2C13...

Re:C++ 20: The Core Language by gumby on Tuesday November 05, 2019 @01:20PM (#21455082)
> On the other hand, there aren't really any changes in 14 and 17 that break compatibility with code written in 11, at least that I'm aware of.

auto_ptr has thankfully be removed, but if you have legacy code that uses it it won't compile under C++17. Of course if you have code that uses auto_ptr you should fix it, but realistically nobody has the time for that.

Re:C++ 20: The Core Language by MauranKilom on Tuesday November 05, 2019 @01:29PM (#21455175)
Depends on how much it was used. But I was part of the effort to convert to C++17 for our (substantial) C++ code base of ~30 years and it was not painful at all.
Re:C++ 20: The Core Language by twoodfin on Tuesday November 05, 2019 @02:20PM (#21455681)
I also ran up against the deprecation of std::mem_fun and std::mem_fun_ref in a recent migration. Easy enough to replace with lambda expressions, but one more hurdle to running C++17 code.
Re:C++ 20: The Core Language by jcelerier on Tuesday November 05, 2019 @03:25PM (#21456279)
all compilers have ways to reinstate them to make porting easier, e.g. /D_HAS_AUTO_PTR_ETC=1 on msvc, -D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES=1 on clang...
Re:C++ 20: The Core Language by ludamad on Tuesday November 05, 2019 @01:27PM (#21455159)
I mean, if tricky usage of auto_ptr is stopping you, you could probably use a drop-in replacement. But the 'and this adds to the sprint tasks how?' question still isn't answered in a good way
Re:C++ 20: The Core Language by TillE on Tuesday November 05, 2019 @02:23PM (#21455715)
You could probably just find/replace unique_ptr. I'm pretty sure that's what I did a million years ago when auto_ptr was deprecated.

C++17 does break some code by removing a few things, but they're pretty trivial and nothing sneaky.

Re:C++ 20: The Core Language by tjalfi on Tuesday November 05, 2019 @11:05PM (#21459638)
clang-tidy has a command to replace auto_ptr with unique_ptr[0]. I haven't used it in anger, though.

[0] https://clang.llvm.org/extra/clang-tidy/checks/modernize-rep...