If there is an expression
((exp1)&(exp2))
POV-Ray will evaluate exp2 even if exp1 is already false and therefore the
whole expression cannot become true anymore. Is there any good reason for
that? I would really wish that it would not evaulate the rest of the
expression as soon as it is evident that its value is not changed by it.
This would make programming quite a bit easier.
Consider following example:
#declare a=array[n]
... (put values into array)
#while((i<n)&(a[i]=0))
#declare i=i+1
#end
If the whole array is 0 then POV-Ray will output an error as i becomes n
and it tries to access a[n]. I have not found a nice workaround for this
problem so I ended up making the array one cell larger... but like that it
is unused memory. I have also come to many other situations where it would
be easier to program when the parsing of & and | would be different.
Maybe it is just me as I am used to this from other programming languages I
use. Is anybody else finding this annoying? I know that changing this can
cause incompatibilities with the current behaviour when people relied that
always the whole expression is evaluated.
- Micha
Post a reply to this message
|