POV-Ray : Newsgroups : povray.general : subtle problem with /*...*/ comment block : subtle problem with /*...*/ comment block Server Time
21 Dec 2024 20:55:16 EST (-0500)
  subtle problem with /*...*/ comment block  
From: Kenneth
Date: 20 Dec 2024 07:50:00
Message: <web.6765668f87e9061ce83955656e066e29@news.povray.org>
While recently coding a long and complex scene, I came across a very subtle
problem when using the  /* .... */  comment block, that caused the parsing of
the scene to fail. I had to tear my code apart piece by piece to find it!

Within a large block of code, I had written a line like this (which has a
mistake in it that I didn't notice):
#declare FOO = 27;  //*3
...just as a way to remind myself to try multiplying the 27 by 3 later.

As-is, the scene parsed and rendered fine. But what  I *meant* to write was:
#declare FOO=27; //   *3

SO...
While continuing to experiment with the scene, I happened to use /* and */ to
comment-out that entire block of code-- which also contained the line with the
mistake.

Now, the scene fails:  "Parse error-- No  */ closing comment found." The parser
apparently sees  part of my   //*3  as  /* -- but only when
another 'complete'  /* ...*/  comment block is enclosing it.

After finding my error, what surprised me is that the scene originally parsed
OK...when it should not have, in my opinion. I think POV-ray should have caught
my initial mistake, and with the same error message.  Adding the /* and */ later
was the only way to 'discover' it...after a lot of head-scratching and
puzzlement. Maybe the *double*-slash-marks-and-asterik prevented the parser from
initially recognizing the error?

Of course, the mistake itself was my own; I can't blame POV-ray for THAT!  ;-)


Post a reply to this message

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