A
Angus
If I need to check if a pointer is valid I usually do a if(ptr) check
first.
But I have seen code such as this:
if((myptr) && (myptr->IsGreen())
Is this valid?
Is it because evaluation is from left to right so that the if(ptr) bit
is evaluated first. Then only if pointer is valid is right function
called?
first.
But I have seen code such as this:
if((myptr) && (myptr->IsGreen())
Is this valid?
Is it because evaluation is from left to right so that the if(ptr) bit
is evaluated first. Then only if pointer is valid is right function
called?