POV-Ray : Newsgroups : povray.advanced-users : problem using ORs and strcmp() in #switch/#case : Re: problem using ORs and strcmp() in #switch/#case Server Time
29 Apr 2024 07:35:59 EDT (-0400)
  Re: problem using ORs and strcmp() in #switch/#case  
From: Bald Eagle
Date: 8 Nov 2017 06:20:01
Message: <web.5a02e7b51346e9e05cafe28e0@news.povray.org>
"Kenneth" <kdw### [at] gmailcom> wrote:

> But here's a very similar example (though without any ORs, which might make all
> the difference), and it selects the 2nd #case (green)...
>
> #switch(true)
> #case(0)
>      rgb <0, 0, 0.2> // BLUE
> #break
> #case(1)
>     rgb <0,1,0> // GREEN
> #break
> ....
>
> This makes sense to me (well, at the moment, anyway!), as it looks like
> #switch(true) is picking the #case with the appropriate 'true' result of (1)

Right.  "true" "on" "yes" all evaluate to 1 in SDL.


> *That's* a really unexpected result, IMO; neither of the #switch's strcmp()s
> 'match' IMG_TYPE (which would be AA), yet #case(1) is chosen as if #switch is
> 'true.'

Yes, (now that I've gotten some sleep, and looked at the #debug output) I see
that's the case.   I probably won't have an opportunity to run any more tests
until tonight.


Post a reply to this message

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