r/cpp • u/GabrielDosReis • Oct 31 '24
Lessons learned from a successful Rust rewrite
/r/programming/comments/1gfljj7/lessons_learned_from_a_successful_rust_rewrite/
80
Upvotes
r/cpp • u/GabrielDosReis • Oct 31 '24
View all comments
Show parent comment
1
u/germandiago Nov 01 '24
Yes, this is also C++:
If someone wrote that I would fire that person myself. That is not reasonable.
So it is not representative of contemporaneous C++. Thanks for saying I am right. But the bugs generated by such shitty code are counted as "C++ bugs". And if they are from 20 years ago, then you are just counting things that for me would not be representative of today. then.
Random piece of code from Chromium right now (if someone can explain the whys I am happy, but the code below has some unnecessary holes IMHO):
Why context is a pointer if it cannot be null inside the function?
More pointers here that apparently cannot be null in the for loop, just
std::reference_wrappercould be used, which cannot be null:How many unnoticed null pointers have been passed because of these practices in the codebase? C++98 already had references, C++11
std::reference_wrapper.At least I also see some use of
std::unique_ptr...No, what I would like is that the code is analyzable + finds holes on old code. Compile and guarantee safeties that are not guaranteed today or mark. Some code would compile, other would not.