Archive: Compiler accepts wrong values for IntOp?!


Compiler accepts wrong values for IntOp?!
I wrote this recently to make a loop counter :

IntOp $R2 R2 + 1
what I meant was of course
IntOp $R2 $R2 + 1

but the compiler never complained, no crashes, only an endless loop, because $R2 didn't get incremented...
Shouldn't the compiler tell me that the value isn't valid?!

Oh :I'm using NSIS v2.0b0


R2 is treated as a string, just like 1 is. Since R2's first char isn't a number NSIS treats it as 0. 0 + 1 is always 1. The first parameter can also be a number or a define, it doesn't have to be a variable...


Oh...
Didnt know that. I can't imagine when you need adding a number and another define, but anyways...
I understand this was a valid command, but in this case I would have wished for for a warning ;-)...

Thanks

KIM


Originally posted by rarefluid
I understand this was a valid command, but in this case I would have wished for for a warning ;-)...
You have now been warned :) Don't do it again ;)