r/ProgrammerHumor • • Oct 27 '26

Meme sameProblemSameSolution

Post image
1.5k Upvotes

79 comments sorted by

View all comments

59

u/Antervis Oct 27 '26

C++03 -> 11 migration was a pain in the ass because of std::string changes, but after that it was basically just changing compiler flags, no?

35

u/Bemteb Oct 27 '26

There are some minor things, if you are unlucky something might break going to 20. But it's mostly special cases, not something so big as string.

The main reason companies don't switch is "it's working, why invest time and money into switching?"

3

u/SeriousPlankton2000 Oct 27 '26

Undefined / implementation defined behavior or regular stuff?

2

u/Antervis Oct 27 '26

Depends on the companies. Tech giants would be losing potential employees if they stuck with outdated standards, and that loss outweighs costs of upgrades.

16

u/cpayne22 Oct 27 '26

Airlines and finance both employ a lot more than “tech giants”.

The real cost is the testing and compliance.

Any change needs to be documented and tested.

At the end of the day it’s a financial decision.

3

u/LutimoDancer3459 Oct 27 '26

Security updates, more and potentially better frameworks, more efficiency,... dont know about c++ but the things the java team added since 8... boy, the reduced server costs will pay for themselves pretty fast

1

u/geek-49 27d ago

it's working, why invest time and money into switching?

aka "if it ain't broke, don't fix it."

1

u/StaticCoder 26d ago

I saw a fair amount of stuff break with C++20, because of comparator generation causing ambiguities. Largely due to the original code being poorly written, but breakage nonetheless.

8

u/ResponsibleWin1765 Oct 27 '26

I thought the entire reason why C++ is so convoluted is because it keeps everything around for backwards compatibility.

5

u/dont-respond Oct 27 '26

Some things do get deprecated and removed like std::auto_ptr. The ABI compatibility was broken for std::string between 03 and 11.

4

u/LB-- Oct 28 '26

And ABI compat isn't even part of the standard, it's for standard library implementations to deal with. They're the ones who decided to do the ABI breaks, not the committee.

5

u/17HappyWombats Oct 27 '26

And turning on all the new warnings and hints and clang-tidy updates and cpp-check checks and other fun stuff. Wherein you learn that sometimes passing a std::string to printf "works" because of SSO, and it's worked in prod for ages.

3

u/meneldal2 Oct 27 '26

For Microsoft they dropped support for some stuff with newer versions. Which was outside of the standard so fair enough but can break projects.

Like references in unions.

-2

u/megayippie Oct 27 '26

The <=> operator was a big pain point. Many of our tests started failing with weird bugs

12

u/Antervis Oct 27 '26

How? Pre-c++20 codebase won't even have them.

1

u/megayippie Oct 27 '26

I honestly don't remember the details or the compiler version. I think the error was because some of our types only partly conformed to ideas of sorting, and that caused some weird interaction where some types in a vector didn't want to test for just ">=" but some other things as well, which we didn't need so didn't implement. Neither "==" nor ">" were there for our types.

The solution was to use more spaceship operators. The error message was clean but we didn't really know how <=> worked yet, so it delayed us a week or so.

5

u/Antervis Oct 27 '26

Ehm... Standard algorithms and data structures use operator < though, even for equivalence.

4

u/SeriousPlankton2000 Oct 27 '26

If neither == nor > are there, how did your types end in a test that expects ordered-like behavior for your types?

2

u/megayippie Oct 27 '26

Oh, the exposed type did, not the inner type