Re:How not to write shitty code: Intentional Conditions
by necovek on Sunday April 19, 2020 @08:48AM
(#22915552)
Another tip is to not be too smart in optimising your conditions either — I've once reviewed a branch with a complex if condition that made no sense, before realising that it was the result of applying De Morgan's rules.
So, express the intent, but do not mathematically simplify or evaluate it (let the compiler/interpreter do that, or if it is really a performance hotspot, describe the intent even though comments are supposed to be about whys and not whats).
So, express the intent, but do not mathematically simplify or evaluate it (let the compiler/interpreter do that, or if it is really a performance hotspot, describe the intent even though comments are supposed to be about whys and not whats).