News for hackers. Stuff that matters.
Re:Compiler Bug Causes Compiler Bug: How a 12-Year-Old G++ B... by ranger_danger on Friday August 15, 2025 @01:59PM (#44915508)
You don't have to use all the fancy new features though. Personally I just stick to C++98 for the most part, unless I really want to use auto or lambdas for some reason, then I might use 11, but I won't go higher.
Re:Compiler Bug Causes Compiler Bug: How a 12-Year-Old G++ B... by whizzter on Friday August 15, 2025 @02:36PM (#44915971)
C++ 11 with lambdas is so much nicer than 98, but even if 14, 17, 20 and 23 have been minor in comparison the accumulated changes have been radical in making what was introduced in 11 into something really useful.

Making anything remotely useful out of templates was deeply into hideous SFINAE-land (substitution-failure-is-not-an-error) leading to horrible unreadable templates during 98 (and the variable-number templates in 11 while being useful only made it explode in horrendeous hacks).

"if constexpr" from C++ 17 and forward actually makes template-expansions not too horrid. you can do template expansions that reads mostly like regular if-elseif-else clauses (and I think that was perhaps part of the impetus for Zig's comptime, starting from this point with a clean slate instead of going through regular template evolution hell).

Re:Compiler Bug Causes Compiler Bug: How a 12-Year-Old G++ B... by jeffbee on Friday August 15, 2025 @04:18PM (#44916869)
The horrendous hacks went away with concepts. SFINAE is dead. Spaceship operator, while perhaps not ideal from every perspective, radically simplifies the workload of implementing comparators.
Re:Compiler Bug Causes Compiler Bug: How a 12-Year-Old G++ B... by saagarjha on Friday August 15, 2025 @05:42PM (#44917580)
Assuming the thing you want actually has a concept, sure.
Re:Compiler Bug Causes Compiler Bug: How a 12-Year-Old G++ B... by majoe on Friday August 15, 2025 @06:29PM (#44918018)
You can define your own concepts. What is your point?

I haven't seen an example yet, where concepts weren't simpler and easier to read/understand than SFINAE shenanigans.

Re:Compiler Bug Causes Compiler Bug: How a 12-Year-Old G++ B... by jeffbee on Friday August 15, 2025 @07:19PM (#44918385)
Not only can you define concepts, it is highly entertaining and educational. You can write a concept that makes a function only available on Tuesdays, for example.
Re:Compiler Bug Causes Compiler Bug: How a 12-Year-Old G++ B... by ranger_danger on Friday August 15, 2025 @07:11PM (#44918330)
I don't use templates hardly at all, and I find the added changes in later versions to seriously complicate what I would prefer to be much simpler, for example initialization rules... so that's one of several reasons I like to stick to older C++ versions.
Re:Compiler Bug Causes Compiler Bug: How a 12-Year-Old G++ B... by addaon on Friday August 15, 2025 @09:01PM (#44919031)
C++ pre- and post- C++11 are really different languages. It’s by far the biggest break (so far in my career) in how the language is used. I’ll gladly debate the detailed trade-offs of many of the newer features, but going back to a world before rvalue references is too horrifying to consider.
Re:Compiler Bug Causes Compiler Bug: How a 12-Year-Old G++ B... by sillysaurusx on Friday August 15, 2025 @02:37PM (#44915977)
Eh, you’re probably missing out. I remember C++20 being really convenient in comparison, though I forget why.
Re:Compiler Bug Causes Compiler Bug: How a 12-Year-Old G++ B... by saalweachter on Saturday August 16, 2025 @07:03AM (#44922174)
Eyeballing C++ 20, struct initialization with .member = blah is the one that jumps out.

But also, since the referenced bug involves Boost... I also haven't used Boost in years, since most everything I was using got pulled into modern C++ versions/STLs.

So if you're using C++98 and Boost, do yourself a favor and just switch to C++17 or 20 or whatever.

Re:Compiler Bug Causes Compiler Bug: How a 12-Year-Old G++ B... by bdhcuidbebe on Saturday August 16, 2025 @01:06AM (#44920341)
Ah yea, why not settle with the 14 year old version?

The MAGA version.