> You may want to have a look at these questions, answers and comments::
> What is "short-circuiting" in C like languages?
> What is short-circuit evaluation in C?
> Is short-circuiting logical operators mandated? And evaluation order?
> My opinion is that writing code that depends on short circuiting is
> bad practice (i.e. hard to understand and debug - and not so portable,
> as you have now experienced).
But in C those expressions are a quite common idiome, like
#define IsNullOrEmpty(s) ((s)==NULL || (s)=='\0')
or – even more common - in expressions like this:
if( s && s->value )
and a lot of C code rely on the short circui rule in these expressions.
And – IMHO – these expressions are not hard to debug, because 's' can be
evaluated easily e.g. in a debugger.
But of course, PovRay scene files are not C. :-)
Post a reply to this message