[fpc-pascal] Coroutines and VirtualAlloc

Ryan Joseph ryan at thealchemistguild.com
Wed Apr 19 11:40:53 CEST 2017


> 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. 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?

procedure TCoroutine.Start;
var
	i: integer = 0;
begin
end;

Regards,
	Ryan Joseph




More information about the fpc-pascal mailing list