News for hackers. Stuff that matters.
Re:Const vs. constexpr vs. consteval vs. constinit in C++20 by devnullbrain on Monday November 28, 2022 @03:21PM (#33778982)
This is a surface-level meme that just doesn't reflect reality. In old C++ you had to spend all your time worrying about manual ctors and memory management. These problems have been erased by improvements to the language. You don't even use raw pointers any more. The language is less complex to use now than it was 10 years ago.

If you've moved on then your insight is outdated.

Re:Const vs. constexpr vs. consteval vs. constinit in C++20 by pjmlp on Monday November 28, 2022 @04:54PM (#33780387)
Kind of true, if we ignore all the code that is in production and no one is going to rewrite for C++20 ways of coding.
Re:Const vs. constexpr vs. consteval vs. constinit in C++20 by devnullbrain on Monday November 28, 2022 @05:01PM (#33780486)
Which would not have its problems solved by halting C++ development or moving to a new language
Re:Const vs. constexpr vs. consteval vs. constinit in C++20 by pjmlp on Monday November 28, 2022 @05:49PM (#33781010)
Anyone working on those codebases needs to be aware of the new ways, while mastering the old ways.

The ideal modern C++ without having to worry about "deprecated" ways of coding, is more the exception than the rule.

Re:Const vs. constexpr vs. consteval vs. constinit in C++20 by usrnm on Monday November 28, 2022 @04:59PM (#33780458)
> In old C++ you had to spend all your time worrying about manual ctors

That doesn't even make sense. Maybe you meant "destructors" but even then it has nothing to do with reality

Re:Const vs. constexpr vs. consteval vs. constinit in C++20 by devnullbrain on Monday November 28, 2022 @08:28PM (#33782490)
I mean constructors. It's the exception to have to do anything meaningful in the body of a constructor in modern C++ - you can do a lot with member initialisation lists, delegated constructors and defaulted/deleted constructors (remember boost::noncopyable?). And your assignment operators will actually be exception safe.
Re:Const vs. constexpr vs. consteval vs. constinit in C++20 by kajaktum on Tuesday November 29, 2022 @12:41AM (#33784083)
Constructors was a mistake. Stupid and simple initialisation like Rust and Go is the way to go forward.
Re:Const vs. constexpr vs. consteval vs. constinit in C++20 by JonChesterfield on Tuesday November 29, 2022 @09:10AM (#33787759)
Constructors induced exceptions, and once we have exceptions they became the failure reporting mechanism of the standard library, leaving us with goto-some-other-function-using-dynamic-scope as one of the foundation blocks of the language. Thus constructors are a reasonable contender for the worst design mistake in C++.
Re:Const vs. constexpr vs. consteval vs. constinit in C++20 by _gabe_ on Monday November 28, 2022 @10:14PM (#33783265)
I think the third definition here sums up what complex means pretty well:

> a group of obviously related units of which the degree and nature of the relationship is imperfectly known[0]

It's impossible for any single person to understand how the C++ language interacts with itself without a reference manual: it's grammar can lead to the most vexing parse; it has metaprogramming builtin using templates or macros, allowing for arbitrary code execution at compile time; it has a ridiculous number of ways to construct an object (move constructors, copy constructors, default constructors, is the object heap or stack allocated, are you using bracket initialization or parenthesis, etc); and more.

Also, I pointed this out in a comment awhile ago, but as of C++17 and over 20 years of writing technical books about C++, Scott Meyers doesn't trust himself to determine whether a given code snippet is or is not valid C++:

> It's not that I'm too lazy to do it. It's that in order to fix errors, I have to be able to identify them. That's something I no longer trust myself to do.[1]

If this language isn't considered complex, I don't know what is.

[0]: https://www.merriam-webster.com/dictionary/complex

[1]: https://scottmeyers.blogspot.com/2018/09/the-errata-evaluati...