skipping "else" statement is faster?
hello
take these two function examples which should do the same thing:
Code:
// standard way
bool function () {
if (a == 0) {
return false;
}
else if (a > 0){
return max (a);
}
else {
return min (a);
}
}
// non-standard way
bool function () {
if (a == 0) {
return false;
}
if (a > 0) {
return max (a);
}
return min (a);
}
It's obvious that the first way is easier to read and way better to do things
I am wondering if the second way would be faster once compiled, or not.