POV-Ray : Newsgroups : povray.advanced-users : It gets even weirder. : Re: It gets even weirder. Server Time
3 Feb 2023 14:12:02 EST (-0500)
  Re: It gets even weirder.  
From: clipka
Date: 27 Aug 2018 05:33:38
Message: <5b83c572$1@news.povray.org>
Am 27.08.2018 um 03:05 schrieb Bald Eagle:
> I broke POV-Ray.
> AGAIN.
> 
> Stephen, I'm pouring Scotch in my coffee...   :|

I'm warning against this workaround, as it only exacerbates the
underlying root cause ;)

> // Run this as-is, and U goes to 11, and V goes to 35
> 
> // NOW
> 
> // change The line below to Usize+1, and U goes to 11, and V goes to 36 !!!  :O
> 
> // How can a variable NOT USED in defining the range of a #for loop change the
> behaviour of the loop!
> //  In BOTH variables!
> //  Usize is never redefined!   W   T   H

PEBCAK Error.

Don't be fooled: The /first/ loop with debug output (recognizable by
printing 3 decimals) /always/ goes to 13 and 36, respectively.

Or rather, it would if it could.

The second loop with debug output (recognizable by printing no decimals)
would always go to 11 and 35, respectively.

The difference is that depending on whether `USize+2` or `USize+1` is
used in the array declaration, POV-Ray may run into an
array-out-of-bounds error when U reaches 13 in the first loop, and never
even start the second loop.


Post a reply to this message

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