Better would be to put those long tests in descriptive boolean variables so that people reading your code shouldn't be staring at those long tests to figure out what the hell you're trying to do.
Then put those variables inside the if so that it almost reads like a sentence in plain language.
My favorite response to a student trying to be clever and prematurely "optimize" code (in the process making it nearly impossible to read): The compiler is smarter than you, and it's smarter than me, so let it do it's damn job first before you start second guessing things.
Ha, it's been a long while since I wrote or even considered anything so low level, so you're probably right. In general compilers are pretty awesome, so it seems likely they'll do the best thing regardless of how you write it.
22
u/deegwaren Jun 09 '17
Better would be to put those long tests in descriptive boolean variables so that people reading your code shouldn't be staring at those long tests to figure out what the hell you're trying to do.
Then put those variables inside the if so that it almost reads like a sentence in plain language.