POV-Ray : Newsgroups : povray.general : #ifdef using a string expression? : Re: #ifdef using a string expression? Server Time
23 Mar 2023 22:20:54 EDT (-0400)
  Re: #ifdef using a string expression?  
From: Kenneth
Date: 18 Mar 2023 11:35:00
Message: <web.6415d8cb98df09c99b4924336e066e29@news.povray.org>
"Bald Eagle" <cre### [at] netscapenet> wrote:

> >
> > So is a string expression the only kind of 'thing' that #ifdef sees
> > as defined?
> > Nope. Even an arbitrary float value behaves the same way:
> >
> > #ifdef(7.6)
> > ...do this... // success
> > #else
> > ...do that...
> > #end
> >
> This is the way POV-Ray works with "Boolean" values (and IIRC, so do other
> computer languages) O is false, and any non-zero value is true.
> Send the str value of true to debug and see what it is.  It's a
> common shorthand to use 0 and 1 for t&f or the setting of "flags" in code.

Yep, I get that-- if the #ifdef is seeing it as boolean, that is. But here's a
weird thing (well, weird to me at this point of my fuzzy understanding):
is apparently seen as NOT defined, and falls through to the #else. Of course,
I'm not even sure if that construct makes any sense code-wise or syntax-wise.
> (And to head off your purely theoretical complaint, 7.6 IS a number, and so it
> IS defined when that ) closes the #ifdef statement.
> You might try that with 0 and see what happens...

Strangely(?), this has the same result as above: #ifdef(0) falls through to the
first clause. So maybe the 'boolean' explanation doesn't hold for #ifdef?

Post a reply to this message

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