Colon Philosophy

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Message
Author
shadeclan
Posts: 61
Joined: 02 Jun 2011 11:29
Location: USA - Somewhere between Albany NY and Bennington VT

Re: Colon Philosophy

#16 Post by shadeclan » 28 Oct 2011 13:54

aGerman wrote::eof is no label. It's only a virtual expression which tells the parser to jump to the end of file. For that reason only for goto :eof needs the colon.

Regards
aGerman

True but when you think "goto" you think "label". Also, according to the WinXP Batch help file:
If command extensions are enabled (that is, the default) and you use the goto command with a target label of :eof, you transfer control to the end of the current batch script file and exit the batch script file without defining a label.
So, even Microsquish thinks of "EOF" as a sort of virtual label available in every batch file as long as command extensions are enabled. That makes "eof" a sort of aberration since it doesn't follow typical label rules.

aGerman
Expert
Posts: 4678
Joined: 22 Jan 2010 18:01
Location: Germany

Re: Colon Philosophy

#17 Post by aGerman » 28 Oct 2011 14:49

Well, actually it's very simple. The syntax is GOTO label except of GOTO :EOF. That's what you can find in the documentation. If GOTO :label works then a programmer will call it "undefined behavior". You can't demand functioning.

Regards
aGerman

shadeclan
Posts: 61
Joined: 02 Jun 2011 11:29
Location: USA - Somewhere between Albany NY and Bennington VT

Re: Colon Philosophy

#18 Post by shadeclan » 31 Oct 2011 06:52

aGerman wrote:Well, actually it's very simple. The syntax is GOTO label except of GOTO :EOF. That's what you can find in the documentation. If GOTO :label works then a programmer will call it "undefined behavior". You can't demand functioning.

Regards
aGerman
Actually, I can demand anything I want. Whether or not I get it is a different matter. :lol:

Post Reply