Re:Bugs found in GCC with the help of PVS-Studio
by raverbashing on Saturday September 03, 2016 @06:33AM
(#12418647)
Yes
I would advocate for the maintenance of both expressions if the comparison is tricky
If this is a hot path that must absolutely be optimized then a comment explaining the conditions is needed
And of course, the != 2 question might change (either because of a bug or logic change) but the == 1 might still be valid, however, if you took the first one your change will break the code
I would advocate for the maintenance of both expressions if the comparison is tricky
If this is a hot path that must absolutely be optimized then a comment explaining the conditions is needed
And of course, the != 2 question might change (either because of a bug or logic change) but the == 1 might still be valid, however, if you took the first one your change will break the code