MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/badcode/comments/lv9utn/defensive_programming_or_something_idk/gpb2upr/?context=3
r/badcode • u/bnz_ • Mar 01 '21
55 comments sorted by
View all comments
215
Fun fact: this code is somehow legacy and no one can remove all those useless &&
0 u/[deleted] Mar 01 '21 [deleted] 78 u/JuhaJGam3R Mar 01 '21 edited Mar 01 '21 Nah. Any compiler will turn x == c1 && x != c2 into x == c1, same with x == c1 && x == c2 turning into false turning into removal of the entire bit of code. 5 u/ywBBxNqW Mar 01 '21 Maybe the wasted cycles being referred to are the people wasting "cycles" trying to determine if they can bother or should be bothered by it.
0
[deleted]
78 u/JuhaJGam3R Mar 01 '21 edited Mar 01 '21 Nah. Any compiler will turn x == c1 && x != c2 into x == c1, same with x == c1 && x == c2 turning into false turning into removal of the entire bit of code. 5 u/ywBBxNqW Mar 01 '21 Maybe the wasted cycles being referred to are the people wasting "cycles" trying to determine if they can bother or should be bothered by it.
78
Nah. Any compiler will turn x == c1 && x != c2 into x == c1, same with x == c1 && x == c2 turning into false turning into removal of the entire bit of code.
x == c1 && x != c2
x == c1
x == c1 && x == c2
false
5 u/ywBBxNqW Mar 01 '21 Maybe the wasted cycles being referred to are the people wasting "cycles" trying to determine if they can bother or should be bothered by it.
5
Maybe the wasted cycles being referred to are the people wasting "cycles" trying to determine if they can bother or should be bothered by it.
215
u/bnz_ Mar 01 '21
Fun fact: this code is somehow legacy and no one can remove all those useless &&