r/badcode • • Sep 13 '20

c Found in git's bisect algorithm

Post image
744 Upvotes

17 comments sorted by

View all comments

69

u/[deleted] Sep 14 '20

What makes it bad? Because they say the algorithm is stupid?

30

u/blehmann1 depraved Sep 14 '20

Well it has to be don't it? There's nothing but the comment and the method signature, and the method signature looks fine to me.

The static is the only thing worth noting because it looks like C++, and in C++ you probably shouldn't use raw pointers. But the keyword does actually have a meaning (although a little obscure) in C. Plus I think Linus Torvalds is pretty damn negative on any C++ code making its way into git.

8

u/CanadianJesus Sep 14 '20

Raw pointers is a bit like raw dogging, if you know what you're fucking around with it's not that dangerous.