Lines between COMMENT & ENDCOMMENT not ignored

Apr 18, 2014
TCC 25.00.11 x64 Windows 10 [Version 10.0.18362.295]
TCC Build 11 Windows 10 Build 18362

I put a COMMENT...ENDCOMMENT around a section of a batch file whilst debugging to test something out. The commented out code contains a subroutine and its label, and I created a new subroutine with the same label after the comment block with the expectation that the call to the subroutine would skip everything between COMMENT and ENDCOMMENT and find the new subroutine (I based this expectation on the HELP which says "The lines between COMMENT and ENDCOMMENT are not parsed").

However, the gosub found the label with the COMMENT...ENDCOMMENT area and executed the statements in the commented out area. Here's a simple batch file to demonstrate the issue, when run it executes the "echo This is inside the comment block" line:
@echo off

echo This is before the gosub
gosub Somewhere
echo Returned from gosub


This is a comment
Everything until the end of this comment block should not be parsed
echo This is inside the comment block

echo This is the correct subroutine
Now that I'm aware of it I can live with it, and it's taken a long time to catch me out, so if nobody else has ever reported it, it can be left alone.
Please, though, put a warning about it somewhere in the help.
Good point Dave, executing code between COMMENT and ENDCOMMENT does rather go against the raison d'être of the commands. If fixing it isn't practicable because of the performance implications then this exception should certainly be flagged up in the help.
Looks like this has been true for some time. I tried the example in v19.10.54 with identical results.
Never tried to have two identical labels in the same batch file.
Oh well, easily remedied by using two full colons (::SomeWhere) inside the comment block or moving that block below the second identical label. :oops:

Similar threads