News for hackers. Stuff that matters.
Re:The Sad Truth About C++ Copy Elision by gumby on Saturday April 03, 2021 @02:20PM (#26683360)
The part that was most problematic is highlighted below.

> Maybe, if you invest enough time and dedication, you'll realize that all these fancy features that C++ implements are unnecessary.

It's true, you can write anything you could write in C++ in a universal Turing machine. I don't write a lot of assembly any more and haven't written microcode in decades but sure, I could write a web server in assembly code.

unwind-protect is thankfully pretty fundamental to avoid typical resource problems; its more than syntactic sugar. When I started writing C code around 1982 it was the thing I missed the most. Counted strings not only avoid a huge number of security problems and bugs, but have been known to be significantly faster than delimited strings since around the same time.

But sure, if you don't care for them don't use C++.

Re:The Sad Truth About C++ Copy Elision by pelmo on Saturday April 03, 2021 @03:05PM (#26683764)
I'm sorry, I don't understand what you're arguing about. I was replying to a person whose use case for C++ nor me, neither you, understand. It could be simple small programs, not hundreds of thousands of lines of code that needs to be managed by modern programmers who write everything in OOP style.

Different people structure their code differently, and programming is like solving a puzzle. You can have a mindset that makes you choose the modern features. We both have different backgrounds and perspectives. Would you go about using a "garbage collected" language without learning why it has garbage collection in the first place? You would, if your goal is to simply make things work as quick as possible, and just trust the tool that you're using. I do not have that trust when I work on my projects.

When I suggest something that is related to programming, I do it from the perspective of quality (e.g. performance and clarity), and understanding of how things work, and from there you're free to do, choose, pick whatever you want.

>But sure, if you don't care for them don't use C++

We're not helping the person who asked "how to go about learning C++ without being worried about its unnecessary complexity" with these arguments. The point is that you can use C++ without its "Modern" features. And you should, if you care about the quality of your code (clarity and performance).

When I'm talking about "Modern" features, I do not mean things like inferred typing or function overloading or templating. But various std:: function/container implementations.

Re:The Sad Truth About C++ Copy Elision by pjmlp on Saturday April 03, 2021 @02:48PM (#26683602)
Maybe I am missing something, but when we care about unwind-protect, I would rather stay with safer languages than C++.
Re:The Sad Truth About C++ Copy Elision by gumby on Saturday April 03, 2021 @03:12PM (#26683821)
Unwind-protect is not just for memory; consider with-open-file.
Re:The Sad Truth About C++ Copy Elision by pjmlp on Saturday April 03, 2021 @03:24PM (#26683933)
Both Lisp examples, and mechanisms available in most modern languages with automatic memory management, no need to dive into unsafe C++ code for them.