|
|
Geoff Wedig wrote:
>
>
> > No, he wants the behavior the C compiler has when evaluating:
>
> > if ((divisor !=0)&&(amount/divisor ...
>
> > That is: if the divisor is 0, the division is not even performed
> > because the left part of the '&&' is false.
>
> > Sincerely, I'm against this idea for POV.
> > (it's ok in C).
>
> Oh, why? Why should POV do extra work when the result is going to be false
> already? The reason it's done in C is to avoid that extra work. Why would
> this be a bad thing? The only case I can think of is if there are side
> effects to the second half of the equation (it calls a macro that creates an
> object and returns a value), but that's so rarely necessary, plus needlessly
> confusing (try figuring out code that has such side effects six months later
> or which you didn't write) that it's not something that we really need.
You said it: it would open the door to needlessly confusing code.
The right way to write it is the current way:
#if (divisor <> 0.0)
#if (amount/divisor ...
There is no need to add confusion for the writer/reader of pov-script
with 'smart' browsing/evaluation of conditional expression.
Post a reply to this message
|
|