NASM Forum > Programming with NASM

The symbol "\" in a comment.

(1/1)

wyvern666:
Hi all.

I understand the use of "\" when writing code. But if this symbol is used after a ";comment" the next code line will be ignored by NASM. I dont know if this can be considered a bug or not, or if have been reported already in the past. It isn't an important thing, but i just wanted inform about it as i think after the ";" that symbol could be ignored... or maybe not?.

Anyway, i found that situation with this commented code:

--- Code: ---...
someRoutine:
        PUSH    ebp                 ;save calling stack frame                  \
        MOV     ebp, esp          ;new stack frame over caller`s stack   | function prologue           
        SUB     esp, 8              ;8 bytes for local variables                /
...

--- End code ---
In that case the "MOV" instruction will be ignored.

Thanks.

Frank Kotler:
Yeah... the '\' character is treated as a line-continuation character if it appears last in a line. Nasm needs to "get" a line from the file before it can "parse" the line to see if there's a comment in it, so it isn't possible to ignore it after ';'. This is intentional behavior, although it's inconvenient if you're trying to do "ascii art" in a comment. If you don't want '\' to be treated as a line-continuation character, put something after it. Even a space will work, although that might be confusing. This broke some existing code when it was introduced, which we try to avoid, but we really needed a line-continuation character...

Best,
Frank

wyvern666:
Yes, i figured out that with even a space after the "\" all will be ok  ;D. Thanks for your answer Frank, as always.

Navigation

[0] Message Index

Go to full version