POV-Ray : Newsgroups : povray.general : Question 'bout indentation (no flamewar) : Re: Question 'bout indentation (no flamewar) Server Time
12 Aug 2024 03:25:00 EDT (-0400)
  Re: Question 'bout indentation (no flamewar)  
From: Nieminen Mika
Date: 29 Mar 1999 13:33:33
Message: <36ffc77d.0@news.povray.org>
Roland Mas <rol### [at] casimirrezelenstfr> wrote:
:   Suppose you have the following lines:

: #if (A > 0)
: union {
: #endif
: sphere { ... }
: #if (A > 0)
: sphere { ... }
: }
: #endif

:   How would you indent?

  In this case the #if statement doesn't stand for conditional code
execution (like 'if' in C) but for conditional parsing instead (like '#if'
in C) (it's often a bad thing that povray doesn't distinguish between these
two things).
  Conditional parsing (or compiling) is always a tricky thing. It makes
the code hard to understand almost always. It's also very hard to indent.
  In this case I usually do something like this:

#if(A>0)
  union {
#end

    sphere { ... }

#if(A>0)
    sphere { ... }
  }
#end

-- 
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

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