Archive: Bug or am I insane?


Bug or am I insane?
I can't figure this one out at all. Please see the attached file. Ignore the random section stuff. There are two functions, getfilename and getfilenamebroke. The only difference is a comment line. But, one function works and the other is broke. I don't have any relative jumps using line numbers so it can't be that. It looks like the IntOp isn't finishing before the StrCpy (though how a comments slows that down I don't honestly know). When I check the stack and variables with Dumpstate::debug, the IntOp looks fine.


As the last character of the line before the comment you've removed ends with a \ NSIS treats the next line as an extension of the line before the removed comment. So NSIS reads it like this:

IntOp $R1 $R1 + 1   ;account for StrCpy $R0 $R0 $R2 $R1


As you can see the StrCpy part is a part of the comment.

Thanks Kichik I thought I was going insane. Of course I use \ everywhere but completely forgot about its significance because of the context and the context in which it was used. I also wouldn't have expected it to work on comment lines.


HM NIS Edit also doesn't interpret this as a comment line, the color isn't the comment color gray. I'll E-mail that guy and let him know.


I forgot this NSIS feature when I wrote the highlighter, but I'm working in solve this.

BTW: The block comments have some issues, see this script:


OutFile TestComments.exe
Name "Test Comments"

Section
This text is ignored /* block comment begin here
some text to fill te comment
block comment end. */ MessageBox MB_OK "This line work fine"
SectionEnd