|
Answer» Steini
Be curious no more !!!
A line is not a proper line unless it is terminated. Normally it makes little difference if a final line of code is completed with a CR/LF, but sometimes a program does not process an input string until it sees the end of the string.
I get exactly the same result as you if I use code with the last two lines looking like Code: [Select]:: g REM H|
By appending a new line I get the result you expected and the code looks like Code: [Select]:: g REM H |
Notepad created this code, and displays a blinking "|" to designate the cursor, i.e. where the next character will appear when you type one. It is NOT part of the code. In each case the "|" denotes the end of the file. The defective code concludes with "H". All it needs to make it work properly is a terminating line-end.
Ten years ago I used an automatic "prettify" program to adjust indentations in a 'C' library. It looked good. I "made" the code and the compiler and linker gave no errors, they just crashed in a heap. I still remember the effort and aggravation before I found that "prettify" had removed the "redundant" final terminating line-end, and that error had absolutely no effect upon the compilation of 48 out of 50 files, but 2 out of 50 had something at the end which required terminating, and without it "the results are undefined" and the best you can hope for is a core dump !!!
Regards Alan Dias
Sorry, I cannot remember the "BAD" code which crashed even when commented out.
I was EVALUATING perhaps several algorithms to do a calculation, and comparing the results. I added another variant and it crashed the CMD shell.
I preceded the variant with "GOTO SKIP1", and FOLLOWED the variant with ":SKIP1" and it still crashed. Obviously the BAT/CMD interpreter suspended execution after "GOTO SKIP1" whilst looking for ":SKIP1", but something in the "BAD" code variant caused it to CRASH.
I preceded every line of the variant (about 20 lines) with "REM ", and it still crashed.
I selected and cut the 20 line variant, and everything worked as it should.
I carefully rebuilt the variant a couple of lines at a time, finding and correcting a few spelling and SYNTAX errors, and got it working. I recognised and corrected my MISTAKES, but have forgotten what they were. I learnt from this that even when a "REM" is being processed, there are some "BAD" code mistakes that can crash the shell.
The next time I make this mistake I will report back
Regards Alan.
|