Am 19.04.2017 11:26 schrieb "Ryan Joseph" <r...@thealchemistguild.com>:
>
>
> > On Apr 19, 2017, at 4:14 PM, Sven Barth via fpc-pascal <
fpc-pascal@lists.freepascal.org> wrote:
> >
> > Those functions simply store (setjmp) and restore (longjmp) register
values (and setjmp also returns the value passed to longjmp if it had been
reached by a longjmp). Nothing more, nothing less. So while the stack
register while be changed, the contents on the stack will not.
>
> Why doesn’t “i” in my example increment? The value keeps going back to 1
even after I used += 1 so its like the old copy of the stack before the
jump got pushed back on top and it started over. I don’t understand how
assembly works but I thought it would just start over and the state of the
stack in that function would still be the same as before so I could keep
adding 1 every pass.

Ah, I didn't catch that earlier. Probably "i" is kept in a register due to
optimization. You should check the generated assembler code to be sure.

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

Reply via email to