When I insert a comment after a line continuation, the compiler throws an error. It would appear that the continuation character takes precedence over the comment character. Is this the intended behaviour?
Command executed:
"C:\FreeBASIC\fbc.exe" "C:\FreeBASIC\FBIDE\FBIDETEMP.bas"
Compiler output:
C:\FreeBASIC\FBIDE\FBIDETEMP.bas(7) error 119: Cannot modify a constant in '"next text string"'
C:\FreeBASIC\FBIDE\FBIDETEMP.bas(11) error 119: Cannot modify a constant in '"last text string"'
Results:
Compilation failed
System:
FBIde: 0.4.6
fbc: FreeBASIC Compiler - Version 1.07.1 (2019-09-27), built for win32 (32bit)
OS: Windows NT 6.2 (build 9200)
You cannot line-continue with the following line being a comment alone (aka: no code first).
Except, you are using block comment followed by code: /' comment '/ _
It may be worth just saying, a line with just a comment (or an entirely blank line) appearing after a continued line, is processed the same way as actual code would be: it's as if the preceding underscore (and anything on the line after it) is stripped away and the contents of the following line is appended. In the case of a blank line or just a comment, then of course nothing interesting is appended.
You can put comments directly after an underscore, so just by putting an underscore before the comment on a blank line, you can keep the line continuing over it.
Thanks for the workarounds. I had already used MrSwiss's first suggestion, but the other two suggestions are more palatable because they preserve the flow of the code.
That said, I still see the compiler's counterintuitive behaviour as more of a bug.
BTW, I don't normally intersperse comments and line continuations. I only did this because I was debugging a particular line of code and wanted to give myself the option of two versions of the code.