POV-Ray : Newsgroups : povray.bugreports : unexpected evaluation of #if(...)? : Re: unexpected evaluation of #if(...)? Server Time
14 Mar 2025 21:19:44 EDT (-0400)
  Re: unexpected evaluation of #if(...)?  
From: Leroy
Date: 7 Mar 2025 18:10:00
Message: <web.67cb7c0029b385b7f60b1886f712fc00@news.povray.org>
"ingo" <nomail@nomail> wrote:
> The following line results in an negative subscript error when Z = 0:
>
> #if (Z > 0 & VoxelGrid[X][Y][Z-1] > 0)
>
> I expected the evaluation to terminate, with false, at Z > 0.
>
> Won't say it is a bug, it is just unexpected.
>
> ingo

I ran into this before. The way I got around it is...

#if(Z>0) #if(array[X][Y][Z-1]>0) do_something.. #end #end

I think it is the negative element of the array is accessed during evaluation
that causes the error.
#ifndef with an array with a negative element or a positive element out of range
will cause an error too. Even throuh clearly element [-1] doesn't exist.

Have Fun!


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.