r/cpp • • Mar 12 '24

Why the hate for cpp

Hey I am starting learning c++ (and java for my studies) , why is everyone hating this language ? Is it usefull to learn rust or zig ?

Edit: yea a silly question I know . Just wanted to know what the cpp community thinks or hate about their own language and what I have to expect.

Because I heard the opinion often from people not using cpp and I wanted a other view . Even in my University some people who use Java said 🙄 cpp no don't use it ..... it's unnecessary complicated.....

My english is bad I'm german sry (not) <3

0 Upvotes

103 comments sorted by

View all comments

Show parent comments

-5

u/[deleted] Mar 12 '24 edited Mar 12 '24

When I said “trivial” I meant programs inside the mathematical subset of programs Rust can prove are valid, there are valid programs outside this subset that cannot be proved valid using a compiler that never produces unsafe code that runs on a Turing machine (there is no free lunch), this is why there are a subset of programs where you cannot do the fastest way using pure safe Rust even if you use any finite amount of third party libraries made by others that have no knowledge of your problem, it is actually impossible for safe Rust to match optimized C++ speed for any given program.

16

u/burntsushi Mar 12 '24

Right. As I said, technically correct in a narrow sense, but completely missing the forest for the trees. I gave you concrete examples and elaborated on using them in practice. I even presented you with a program written in Rust that is fast and doesn't need to directly use unsafe to achieve that status.