Xardex wrote...
Madness. I have used half a dozen compilers and this is the first time I find myself unable to declare variable inside a loop. I suppose its a fairly common function in compilers, or I have been rather lucky.
Ironically, I have used nwscript easily the most and it's where I began coding!
The differance here is that the NWN compiler creates the variable at the same place in the code where it hit the declairation. Where normaly compilers produce code that create all of the variables at the begining of the compiled code that they create. In short if what you wrote
for(int i... was allowed to compile, the compiled code would end up creating a new variable on every loop iteration. The when the script finished you would end up with a stack overflow/underflow error during run time. The same thing also often happens when variable declrations are placed in the loops, Not the compiler error, just the stack errors during run time.
Modifié par Lightfoot8, 26 février 2012 - 05:30 .