POV-Ray : Newsgroups : povray.programming : "Clean" debugging : "Clean" debugging Server Time
26 Oct 2025 18:00:33 EDT (-0400)
  "Clean" debugging  
From: Bald Eagle
Date: 23 Oct 2025 10:10:00
Message: <web.68fa360b84d70c9376d02faa25979125@news.povray.org>
So, I have had to include a lot of output to the debug stream to inspect values
passed into macros, compare results of macros to tests done in other macros, and
inspect the code flow so that I can see how the logic of various test results
get directed.

Doing
#if (Test)
     #debug (something)
#end

clutters the code, is tedious, and if everything is spread out all across the
code, it is a nightmare to turn on and off.

So what I did was test for a Global_Debug identifier, and if defined, then I
enable the #debug statements.

I do that by creating a macro called Debug ()

Then everything gets wrapped in Debug ( ), sans the #debug statement.
Then it's just one line, can be kept in the code, is trivial to turn on and off,
and all of the #if () #end stuff is in a single tiny macro.

It's simple, and I suppose obvious, but just thought I'd include it here in case
anyone derives benefit from it.

- BE


Post a reply to this message

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