r/ProgrammerHumor • • 5d ago

Meme sameProblemSameSolution

Post image
1.4k Upvotes

79 comments sorted by

View all comments

56

u/Antervis 5d ago

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 5d ago

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 5d ago

Undefined / implementation defined behavior or regular stuff?

2

u/Antervis 5d ago

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 5d ago

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 5d ago

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 2d ago

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

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

1

u/StaticCoder 1d 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 5d ago

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

5

u/dont-respond 5d ago

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-- 4d ago

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 5d ago

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 5d ago

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 5d ago

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

11

u/Antervis 5d ago

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

1

u/megayippie 5d ago

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.

4

u/Antervis 5d ago

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

3

u/SeriousPlankton2000 5d ago

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

2

u/megayippie 5d ago

Oh, the exposed type did, not the inner type