On 18/04/18 12:15, wkitt...@windstream.net wrote:
On 04/17/2018 11:06 PM, James Richters wrote:> I have a whole section of diagnostic writeln's in a program, and it's tedious to comment them all out/in as needed.   I'm curious if doing something like

what's wrong with traditional IFDEF?? use something like this...
{$IFDEF DEBUG}writeln ('blahblahblah');writeln (LOGFILE,'blahblahblah');flush (LOGFILE);{$ENDIF}

then you simply create the DEBUG define...
-DDEBUG
if you don't want it, leave it out and none of the bracketd code is even included...

I agree. Another possibility is something like

{$if declared(customDebugWrite) }
  customDebugWrite(...);
{$endif declared()         }

so if customDebugWrite() isn't present in the program during compilation (commented out, or the entire unit containing it omitted) no attempt will be made to call it.

--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to