|
 |
> You may want to have a look at these questions, answers and comments::
>
> What is "short-circuiting" in C like languages?
>
https://softwareengineering.stackexchange.com/questions/201896/what-is-short-circuiting-in-c-like-languages
>
> What is short-circuit evaluation in C?
> https://stackoverflow.com/questions/45848858/what-is-short-circuit-evaluation-in-c
>
> Is short-circuiting logical operators mandated? And evaluation order?
>
https://stackoverflow.com/questions/628526/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]=='\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. :-)
Lars R.
Post a reply to this message
|
 |