I always dare NOT to code like this:
void func( some_struct* ptr ) {
if ( ptr != nullptr && ptr->errorno == 0 )
do something...
};
instead I always do like this:
void func( some_struct* ptr ) {
if ( ptr != nullptr )
if ( ptr->errorno == 0 )
do something...
};
because I'm afraid that the evaluation order of logical operator && is un-specified in C++ standard, even though commonly we could get right results with almost all of nowdays compilers. In a book, 2 rules let me want to get known exactly about it.
My question is : Without overloading, is the evaluation order of logical operator "&&" and "||" definite?
Sorry about my ugly English, I'm a Chinese. and I apologize if there is a duplicated topic, because I can't finger out correct key-words to search with. Thanks anyway!