[postgis-users] 1.3.3 Pre-Release Notice

Mark Cave-Ayland mark.cave-ayland at siriusit.co.uk
Thu Apr 10 15:26:06 PDT 2008


> Your "very strong feeling" is wrong in this case. Evaluation order
> for function arguments in C is not specified. However, '&&' and '||'
> are not functions. In C/C++, and several other languages, '&&' and
> '||' are short-circuit operators, NOT logical operators. Millions of
> lines of C (or C++, Java, Perl, JavaScript, etc.) would crash or
> otherwise fail if constructs like
>
>     if (ptr && *ptr) { /* do something */ }
>
> did not work as expected. See
>
>     http://en.wikipedia.org/wiki/Short-circuit_evaluation
>
> for a more complete description of this common computer language
> feature.

Fascinating. Being self-taught in C, it's always interesting to learn
something new - even if it does go against intuition :)


ATB,

Mark.

-- 
Mark Cave-Ayland
Sirius Corporation - The Open Source Experts
http://www.siriusit.co.uk
T: +44 870 608 0063




More information about the postgis-users mailing list