POV-Ray : Newsgroups : povray.general : subtle problem with /*...*/ comment block : Re: subtle problem with /*...*/ comment block Server Time
21 Dec 2024 21:30:10 EST (-0500)
  Re: subtle problem with /*...*/ comment block  
From: Leroy
Date: 20 Dec 2024 15:05:00
Message: <web.6765cca5f8229af4f37dd6fef712fc00@news.povray.org>
"Kenneth" <kdw### [at] gmailcom> wrote:
> 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!  ;-)

I had to play with this a little and found another fact.
/* wrrtr
//*3
fdssdds
*/
*/
With this in to code POV still ran with no errors.
Even through the last '*/' doesn't turn green in the win Pov 3.7 editor.
Have Fun!


Post a reply to this message

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