In article <a7**************************@posting.google.com >, gndm_2001
@yahoo.com says...
Just wondering, is it portable to write:
something* pSomething = getSomething();
if( pSomething && pSomething->stuff() ) {
...
}
I'm not sure if the condition statement is always shortcircuited for
every implementation of C++?
Yes it is, UNLESS you've overloaded operator&& for the types involved.
If you have something that doesn't short-circuit evaluations like this,
it's not C++ and not really even much like C++ (or C) either -- if I'm
not mistaken, short circuit evaluation has been been part of C since
before the beginning (i.e. back at least as far as B, and quite possibly
to BCPL or even CPL).
--
Later,
Jerry.
The universe is a figment of its own imagination.