← Back to team overview

yade-dev team mailing list archive

Re: CohesiveFrictionalContactLaw "box"

 

> One technical question : when one write "if (c1 && c2 && c3)", are tests 
> c2 and c3 still evaluated when c1 is  "false"?
>   
no, not in c (and c++). It's called short-cirtuited evaluation and it
allows you to write things like:

int* a=NULL;
/* do something */
if (a && (*a)<10) { /* *a is a number */}
else{ /* a is NULL */ }

Otherwise if a were still NULL, you would get segfault at the
dereference *a.

(Pascal doesn't have that, for instance, unless specifically requsted.)

Vaclav

_______________________________________________
yade-dev mailing list
yade-dev@xxxxxxxxxxxxxxxx
https://lists.berlios.de/mailman/listinfo/yade-dev



References