[fpc-pascal] Using constants instead of comments

Sven Barth pascaldragon at googlemail.com
Wed Apr 18 07:43:25 CEST 2018


James Richters <james at productionautomation.net> schrieb am Mi., 18. Apr.
2018, 05:00:

> 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
>
> Const
>    diagnosticdetail=false;
>
> If diagnosticdetail then Writeln('diagnostic info');
>
> Is the same as
>
> // Writeln('diagnostic info');
>
> And the Writeln will actually end up being left out of the compiled
> program altogether... since the constant will never allow it to run,  or if
> not, is there a better way to optionally exclude diagnostic information
> entirely from the compiled program?
>

It should be excluded. You can confirm this by checking the assembler
output generated with "-al".

Regards,
Sven

>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20180418/b333d7ff/attachment.html>


More information about the fpc-pascal mailing list