top | item 46133330

(no title)

_hao | 2 months ago

I love C++ for the power it gives me, but boy do I hate reading C++ code. I know most of these things are for historical reasons and/or done because of parser compatibilities etc. but it's still a pain.

discuss

order

werdnapk|2 months ago

I used to live and breath C++ early 2000s, but haven't touched it since. I can't make sense of modern C++.

TuxSH|2 months ago

> I can't make sense of modern C++

A lot of it is about making metaprogramming a lot easier to write and to read.

No more enable_if kludges since if constexpr (and concepts for specific stuff); and using concepts allows to better communicate intent (e.g.: template<typename I> can become template<std::integral I> if you want the template to be used only with integer types, and so on)

SJC_Hacker|2 months ago

You may want to watch some of Herb Sutters videos. He is one of the few sane people left in the upper echelon of C++ supporters

SJC_Hacker|2 months ago

Only if by power you mean performance. Otherwise C++ is not a very ”powerful” language.

I’d like to see an example of a task that can be done with less verbosity in C++ than say, Python, using only the standard library

sorenjan|2 months ago

    ++foo; // Increment value of foo by one

    foo += 1 # Increment value of foo by one