logoalt Hacker News

rixed • yesterday at 8:50 PM • 5 replies • view on HN

Going on a tangent, but I'm always owndering if "modern C++" sounds rather appealing or off-putting to most people?


Replies

moltopoco • yesterday at 10:12 PM

Just one data point, because I have to get it off my heart. I loved Modern C++ when it meant C++11, but I've become more negative with each new language standard reaching my workplace.

Using string_view over string by default is probably the #1 cause of memory errors that landed on my desk. I also keep hearing that "int x{0}" is preferable to "int x = 0" which allows for super dangerous implicit conversions, but then the same people rewrite push_back into emplace_back, which is much more lenient w.r.t. type conversions. It is also much easier to litter every function with [[nodiscard]] constexpr nothrow than it is to argue for readability.

My best explanation is that "Modern C++" is making developers biased towards whatever language feature is newer, instead of making good decisions. I wish the community gave up on the moniker.

➕ show 2 replies
jandrewrogers • today at 1:01 AM

In the case of C++, "modern" conventionally denotes "C++11 or later". Idiomatic code between "legacy" and "modern" dialects of C++ that they almost look like different languages. C++11 was a breaking change to the idioms of older C++.

This is helpful context to the reader. Many C++ programmers are unfamiliar with either idiomatic legacy or modern dialects and would have difficulty following the code.

There are arguably three different idiomatic dialects of C++ now: legacy, C++11, and C++20. We don't really have a common term for distinguishing between C++11 and C++20 even though the idiomatic code looks quite different.

It has been an interesting evolutionary strategy. C++ standards meticulously avoid breaking changes but will happily do a major redesign of how idiomatic code is written.

htfy96 • yesterday at 10:36 PM

Yes. Using C++23 in work with house-built coroutine abstraction is very fun and robust. Have to admit that it just requires certain level of skills of your colleague, and unfortunately general hires don't have.

omoikane • yesterday at 9:16 PM

Maybe they are referring to Effective Modern C++ book by Scott Meyers.

I think "modern" is used to contrast newer C++ standards from C++98.

➕ show 1 reply
eluru • today at 2:24 AM

Sounds tiring, CPP has been modernised, killed, solved, so many so so many times now, not even one was for real, this wont be the one either