top | item 38780253

(no title)

nox100 | 2 years ago

I think you missed the point. The point isn't that these features don't have a purpose. The point is rather, at every line of code you have many choices that you arguably shouldn't need. Should I use a raw pointer or a unique_ptr or a smart_ptr. Do I need to call make_shared here or can I do something else? Should I call std::move here or not? Should pass by value or pointer or const pointer, or reference or const reference? And on and on, every line is a foot gun.

I get why it's that way, backward compatibility. The problem is, the original way, the path of least resistance, is now effectively deprecated, but it's the official syntax.

    char* s = malloc(size);
is considered bad code. I get why. But, in a "good language" the default would do the right thing and I'd only escape into bad code by extra work so that all the easiest code to write did the right thing by default.

C++ is trying to fix all that old bad code by coding standards and linters but I don't want to have to type a bunch of boilerplate I need to memorize to do the right thing. I want the right thing to be the most obvious, no brain cells required path.

discuss

order

No comments yet.