Archive: Basic goto offset question


Basic goto offset question
Sorry for this newbie question however this is quite important stuff as you can imagine ;-)
Normally i thought i understand how it works e.g.:

StrCmp "" "" +2 0
DetailPrint "Line 1 ..."
DetailPrint "Line 2 ..."
DetailPrint "Line 3..."


The output is:
Line 2...
Line 3 ...
-> It jumps to the 2nd instruction, however in the following case it is not:

StrCmp "" "" +5 0
SetOutPath "\SomeUnimportantPath"
SetOverwrite on
File "someUnImportantFile.txt"
IfErrors ErrorWrite ; jumps to ErrorWrite label
DetailPrint "Should be printed out"


-> However the last line is not printed even though its the +5 instruction. If I use +4 everything works however i don't get it then... What am i missing here?

SetOverwrite is probably not a runtime instruction.

Save yourself some trouble and use labels or even better, logiclib.nsh...


Hah, very nice catch!


It is well documented in manual - section 4.4 Relative Jumps and 4.9 Instructions:

An instruction is every command that is executed at run-time, when the installer is running. MessageBox, Goto, GetDLLVersion, FileRead, SetShellVarContext are all instructions. AddSize, Section, SectionGroup, SectionEnd, SetOverwrite (and everything under 4.8.2 Compiler Flags), Name, SetFont, LangString, are not instructions because they are executed at compile time.


Thanks for the info and the hint to the documentation.

In my case you are right
SetOverwrite
doesn't count since it is not a runtime instruction. Now I better recheck the rest of my code :D