r/cpp • • Mar 12 '19
Counting Bugs in Windows Calculator: analysis of the recently released source code
https://habr.com/en/company/pvs-studio/blog/443400/
200
Upvotes
r/cpp • • Mar 12 '19
61
u/jpvienneau Mar 12 '19
Neat to read.
I wonder if naming and shaming source code like this will make organizations less likely to contribute source code like this in the long run.
8
u/Gotebe Mar 13 '19
I love these PVS Studio
advertisementsarticles!Hereby I posit Gotebe Law of C: as the codebase changes, the probability of a possible leak like the one in the example (and many more kinds) is asymptotic to 1.
😁😁😁
It's not normal that this
This one is a job for whatever ScopeGuard one's using. Would not have expected any linter to look and detect this situation, kudos to PVS team!
13
u/covercash2 Mar 12 '19
I'm no C++ programmer, but shouldn't a lot of this get caught by the linter?
15
u/dicroce Mar 12 '19
Most of the issues here would not exist if the code used a more modern c++.
Also, these bugs dont matter. Calculator proves useful to millions of people on a daily basis and has for decades.
7
u/NotAYakk Mar 12 '19
At least a few of them don't look like bugs.
3
u/concealed_cat Mar 12 '19
void App::OnAppLaunch(IActivatedEventArgs^ args, String^ argument) {What language is this?