Lines between COMMENT & ENDCOMMENT not ignored

Apr 18, 2014
299
9
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:
Code:
@echo off

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

QUIT

COMMENT
This is a comment
Everything until the end of this comment block should not be parsed
:Somewhere
echo This is inside the comment block
return
ENDCOMMENT


:Somewhere
echo This is the correct subroutine
return
 
Apr 18, 2014
299
9
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.
 
Apr 18, 2014
299
9
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.
 

rps

Jul 6, 2008
436
6
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
Thread starter Title Forum Replies Date
T WAD Difference between TCC and CMD in handling multi-command lines Support 6
old coot Spurious errors (triggered by "for" construct?) when adding/removing "echo" lines Support 1
vefatica Continued lines (^) in a library routine? Support 5
A TCMD - Dir Command puts out blank lines? Support 16
T FFind - can we display n number of lines after the find? Support 2
JohnQSmith Weird DIR output (missing lines) Support 1
fpefpe Documentation Comment lines? Support 2
nickles Fixed Executing long command lines in a batch generates file name errors Support 16
B %@lines doesn't count last line without cr/lf at eof Support 1
nikbackm How to? Find duplicate lines in text file Support 0
S Documentation HELP nit: @LINES Support 5
B Select and run lines from Command Input panel? Support 1
D WAD New envars for @LINES are not hidden Support 8
T Documentation @LINE[CON,n] @LINES[CON] not documented (bug?) Support 4
M How to? Parsing lines containing double quotes... Support 3
Stefano Piccardi echoerr truncates long lines Support 9
M Just an out-of-curiosity question the List command vs. the @Lines function... Support 13
samintz How to? Pull out multiple matching lines Support 5
W Copy+Paste without breaking long lines as default? Support 1
L "for" in multiple lines Support 2
vefatica @LINES, long lines, TCC disappears Support 7
D Blank lines in jpstree.idx Support 3
T @Word from Lines with Pipes Support 3
vefatica @LINES[]? Support 1
J Extra blank lines during paste Support 6
vefatica How many lines are in this file? Support 17
nikbackm Trim last N lines from a file Support 6
T How do you echo lines with special characters to file? Support 4
B @lines: first line in the file is numbered 1 Support 0
R Reading an Unicode file with more than 8191 lines Support 1
D Differences between TCC and CMD with COPY /b Support 4
R Difference between TCC and CMD: variable names with hyphens Support 4
W pdir returns diff results between tcc and tcmd - one is an error msg Support 5
M Command line parsing differences between cmd.exe and TCC Support 6
L WAD bad interaction between echox and command grouping Support 9
C Documentation difference between appdata and localappdata ? Support 6
D Fixed Change in behavior of variable expansion between 16 and 17 Support 3
Joe Caverly How to? Move Window Between Monitors Support 6
epement differences in IDE/debugger between v12 and v14 Support 1
beerns different results between tcmd and cmd Support 2
C sharing global histories between different TCMD versions? Support 5
Jay Sage Inconsistency in Date Formats Between @DATE and @MAKEDATE Support 3
fpefpe Key Names to toggle between tab windows Support 1
Joe Caverly Move Buttons Between Tabbed Toolbars Support 2
D sync navigation between Folders List panel and the Tabs console Support 11
Joe Caverly TCEDIT and Toggle Comment Support 4
Peter Murschall A little problem with LEAVE and COMMENT Support 5
D [cosmetic] Shortcut for v24 still has v23 in its comment Support 1
w_krieger TCMD 20 beta comment Support 0

Similar threads