On Wed, 19 Apr 2017, Ryan Joseph wrote:


On Apr 19, 2017, at 4:33 PM, Michael Van Canneyt <mich...@freepascal.org> wrote:

Your reasoning contains a wrong assumption, namely that I is on the stack.

If I is a register variable, then it is not on the stack, and will be reset
with each longjmp.

I thought all variables declared inside a function (like below) were “on
the stack” and I don’t even know what a register variable is honestly.

It's a variable which the compiler does not put on the stack, it exists just
in a register.

 Is
there a way to make my example work and not have “i” reset each jump by
declaring it differently or is that the choice of the compiler?

The compiler chooses this. But you can disable it, I think, by disabling
optimizations.

Michael.
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to