[GRASS-dev] G_point_in_region() ?

Brad Douglas rez at touchofmadness.com
Tue Feb 13 21:48:23 EST 2007


On Wed, 2007-02-14 at 14:23 +1300, Hamish 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.

For the above to continue into the if branch, both variables must return
a value >= 1.  ANSI C specifies that order of operation is guaranteed
left to right for '||', '&&', and '?:'.

In short, if the left-hand expression is 'false', the right-hand
expression will not be executed.

>   if(TRUE || G_something())
> 
> is there a chance G_somthing() will get run in the OR case?
> (the first term will know if the G_() call will be valid)

See above.


-- 
Brad Douglas <rez touchofmadness com>                    KB8UYR/6
Address: 37.493,-121.924 / WGS84    National Map Corps #TNMC-3785




More information about the grass-dev mailing list