G
gallows
Hi,
I wondering if there is a standard specification for evalutation of
logical expressions. For instance:
if (p != NULL && strlen(p) > x )
do_something();
If p is actually NULL, should this code (built with a generic
compiler) crash?
Considering that the first element is FALSE, evalutation of strlen()
is useless, so it (theoretically) should be skipped...
My compiler (gcc) works as I expected, is it a standard behaviour?
Thanks,
s.
I wondering if there is a standard specification for evalutation of
logical expressions. For instance:
if (p != NULL && strlen(p) > x )
do_something();
If p is actually NULL, should this code (built with a generic
compiler) crash?
Considering that the first element is FALSE, evalutation of strlen()
is useless, so it (theoretically) should be skipped...
My compiler (gcc) works as I expected, is it a standard behaviour?
Thanks,
s.