4 ms·
> for example I knew a guy that’d auto reject C PR’s if they didn’t use the syntax if (1==x) rather than if (x==1). The former will not compile if you accidenta
by frou_dh 2y ago
> for example I knew a guy that’d auto reject C PR’s if they didn’t use the syntax if (1==x) rather than if (x==1). The former will not compile if you accidentally use variable assignment instead of equality operator
I've seen that one and personally dislike that mindset: Making the code less readable to compensate for a disinterest in using actual static analysis tooling.
- kubanczyk 2y agoLess readable? I agree these are less readable: if (987654321987654321==x) if (find_optimal(frobnicator(x)*8)==1) while these are subjectively more readable: if (x==987654321987654321) if (1==find_optimal(frobnicator(x)*8))
- tuveson 2y agoThese days GCC and Clang will both give you warnings for this if you have -Wall, which everyone should.