News for hackers. Stuff that matters.
Re:Care is needed to use C++ std:optional with non-trivial o... by jay-barronville on Friday January 13, 2023 @08:47AM (#34367573)
> But in this case C isn't even any different, so this tangent is irrelevant anyway. If you take a struct by value in C it, drum roll, copies it!

You’re absolutely correct, but I also don’t have to worry about copy versus move semantics and all that other jazz in C — the mental model is simply value copies or pointer copies, that’s it.

Re:Care is needed to use C++ std:optional with non-trivial o... by kadoban on Friday January 13, 2023 @09:42AM (#34368325)
By the time you actually add enough libraries to be able to get something done, you have to worry about the same concepts, the names are just different and it's less consistent since the language doesn't help or have a position on how it works.

C is a simple language the same way my car is simple if I take the engine out.

Re:Care is needed to use C++ std:optional with non-trivial o... by jay-barronville on Friday January 13, 2023 @09:58AM (#34368569)
What a false equivalence. I don’t understand the need to pretend like C++ isn’t a minefield of complexity (especially compared to C). I don’t hate the language and C++ programmers tend to be some of the smartest programmers I know/encounter, but can we please not be deliberately obtuse here?
Re:Care is needed to use C++ std:optional with non-trivial o... by kllrnohj on Friday January 13, 2023 @10:10AM (#34368765)
C is a minefield of complexity, though, why are you so desperate to pretend it isn't? The reality is that much of the language complexity of things like C++ or Rust is because the problem space is actually complex. C's language just doesn't help you with the inherent complexity. In fact it actively encourages bugs as a result. That's not a simple language, it's a bad one. It was fine for the constraints of the time, but it's not anymore.

C is easily the least defensible language choice of the commonly used languages. There's so many just obscenely better options it's not even funny. See also why even "intentionally C-like" languages like Zig are growing increasing complexity https://github.com/ziglang/zig/issues/7769 Or why things like D's betterC adds all the same "objectionable" stuff C++ does - RAII, operator overloading, etc...

Re:Care is needed to use C++ std:optional with non-trivial o... by kadoban on Friday January 13, 2023 @11:41AM (#34370248)
> I don’t understand the need to pretend like C++ isn’t a minefield of complexity (especially compared to C).

C++ is a minefield. So is C though. Comparatively they're pretty much in the same boat for me. Sorry I guess?

Re:Care is needed to use C++ std:optional with non-trivial o... by jstimpfle on Friday January 13, 2023 @12:33PM (#34370968)
What a weird analogy.

The truth is that you can't explore a C++ codebase without actually stepping through it with the debugger. You literally can't see all the places where you end up. A mechanism to do the type resolution is needed, and that is a much, much bigger mental load.

In C you can see each and every jump by default (unless someone does terrible hidden macro magic etc). Maybe add a code browser for convenience. You can often get a pretty good idea of a codebase just by browsing it. These are definitely diferent qualities.