[GRASS-dev] G_point_in_region() ?

Glynn Clements glynn at gclements.plus.com
Wed Feb 14 06:43:15 EST 2007


Brad Douglas wrote:

> > a C question:
> > 
> >   if (FALSE && G_something()) 
> > 
> > will stop as soon as it tests the first term (FALSE) and won't execute
> > G_something(), does OR work the same way?
> 
> These days, that may be up to the compiler (tunable?).  Some
> architectures offer parallel branching that would execute both
> simultaneously and compare results.  Glynn would know more details.

C's && and || operators are guaranteed to stop once the answer is
known. Any subsequent expressions will not be evaluated, in the sense
that if those expressions have "visible" side-effects, those
side-effects will not occur.

Visible side-effects include modifying variables, calling functions
(except for locally-defined functions which are known to have no
visible side-effects), dereferencing pointers, and reading "volatile"
variables.

-- 
Glynn Clements <glynn at gclements.plus.com>




More information about the grass-dev mailing list