[fpc-pascal] Coroutines and VirtualAlloc

Michael Van Canneyt michael at freepascal.org
Wed Apr 19 12:17:14 CEST 2017



On Wed, 19 Apr 2017, Ryan Joseph wrote:

>
>> On Apr 19, 2017, at 4:33 PM, Michael Van Canneyt <michael at 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.


More information about the fpc-pascal mailing list