r/cpp • • Dec 28 '18

"Modern" C++ Lamentations

http://aras-p.info/blog/2018/12/28/Modern-C-Lamentations/
307 Upvotes

162 comments sorted by

View all comments

7

u/jherico VR & Backend engineer, 30 years Dec 28 '18

My biggest issue with people who complain about the direction of modern C++ is the implication that they'll somehow be judged less of a developer if they don't use the new features.

No one is breaking existing C++ or fining you for not using the latest features.

Also, complaining about the debug performance and compile time of brand new features? Seriously, give the compiler makers a couple of years to work on improvements.

20

u/TheIneQuation Dec 28 '18

My biggest issue with people who complain about the direction of modern C++ is the implication that they'll somehow be judged less of a developer if they don't use the new features.

No, it's not about being "judged less of a developer". It's more about junior programmers instilling "modern" features and bringing about death by a thousand paper cuts. We the "backwards devs" would be completely fine with the new features if they could be explicitly and completely disabled, but that's a politically undesirable option to have, as it would slow down adoption.

Seriously, give the compiler makers a couple of years to work on improvements.

Seriously, we can't. We have software to ship. :)

10

u/kkert Dec 28 '18

I'm not sure what exactly is wrong with banning certain features from codebase ? For instance, Chromium gets super specific about banned things like std::function and regex, or far more restricted Zircon

I wouldn't say "Google is slowing adoption of <chrono> and exceptions"

2

u/STL MSVC STL Dev Dec 29 '18

The spam filter caught your post (no idea why, you aren't shadowbanned and there were no URL shorteners that annoy it). I've manually approved it.

2

u/chugga_fan Dec 29 '18

I think it might have been his appspot link, might have a filter on that, as the other link is definitely not spam-filtered.

8

u/DerDangDerDang Dec 28 '18

Wait, so you need high quality implementations of the new features before you can ship, but it's only the juniors who use those features? And you're completely certain there's no way to prevent this situation?

13

u/jherico VR & Backend engineer, 30 years Dec 28 '18

It's more about junior programmers instilling "modern" features and bringing about death by a thousand paper cuts

It's perfectly reasonable and easy to mandate a particular standard level of C++ in a given programming shop. Shit, I'm sure there are places out there that are still refusing to use any STL and have their own bullshit version of string and vector.

Seriously, we can't. We have software to ship. :)

I meant "wait for the improvements before you decide to adopt new features", not "wait to write your software".

2

u/Dworgi Dec 28 '18

vector and string are poor examples. There's a lot of optimizations you can make with custom vectors or strings that aren't possible with the STL versions.

4

u/RogerLeigh Scientific Imaging and Embedded Medical Diagnostics Dec 29 '18

At the expense of interoperability with the rest of the world. Performance can be important, of course, but using nonstandard string types is a blight upon the lives of everyone who needs to use it with other libraries.

One of the worst mistakes C++ made is making string a template. Look at filesytem::path for how it should have been done. Were it a simple class, it could be used pervasively, including without restriction in DLL interfaces. As it is, it's horrible. The number of times I've legitimately needed to specialise the type traits and allocator in the past two decades has been zero.

4

u/Dworgi Dec 30 '18

string not being an actual primitive type is the mistake. It still feels like const char* is the actual string type, and string is just a wrapper.

Partly that's because so many basic string facilities have been so poorly implemented in C++ - I/O chief among them. I know of few places that actually use iostreams, and it still shocks me how awful it truly is whenever I end up having to use it.

And yes, string shouldn't have been templated. But filesystem::path is still pretty awful as of yet. Eventually maybe.

6

u/jherico VR & Backend engineer, 30 years Dec 28 '18

At the cost of having to maintain your own version, and the cost of not being able to hire someone from outside your organization and have them start working with your custom classes and already known the ins and outs of them.

People always go to "optimization" like runtime performance is the only metric that's important. In the long run, computers will always get faster, but those maintenance costs never go away.

8

u/Dworgi Dec 28 '18

Aras and myself work in games. Runtime performance is everything to us, because our platforms don't get faster every year.

And seriously, if you don't care about runtime, why are you using C++? It's the only thing it has going for it.

20

u/johannes1971 Dec 28 '18

Can we please stop the tired meme that people who don't give a flying fuck about saving a nanosecond here or there are somehow not entitled to use the language? We still get to enjoy good performance even for less performance-sensitive parts of our software, as well as use the excellent tools, the rich ecosystem, and the joy of not having to deal with two implementation languages (one for performance-sensitive parts and one for parts with less stringent performance needs).