[fpc-pascal] Using constants instead of comments
Mark Morgan Lloyd
markMLl.fpc-pascal at telemetry.co.uk
Wed Apr 18 14:50:00 CEST 2018
On 18/04/18 12:15, wkitty42 at 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]
More information about the fpc-pascal
mailing list