Boost logo

Boost Users :

Subject: [Boost-users] [context] How to set stack pointer in a platform-independent way?
From: TONGARI J (tongari95_at_[hidden])
Date: 2014-09-18 23:02:50


Hi,

The problem had been discussed here:
https://groups.google.com/forum/#!topic/boost-devel-archive/cl8B1oUPrVM

But it's still not clear how to set the stack pointer portably, even after
examining the code of Boost.Coroutine. For now, Boost.Context only supports
downward stack, and Boost.Coroutine, which happened to be written by the
same author, just assumes that the stack always grows downward, which is
not really a portable implementation, if future Boost.Context supports
upward stack, Boost.Coroutine has to be changed as well.

Even than that, what does "beginning of the stack" really means?
Suppose we have a stack of size 3, starting at [s]:

[s-1][s][s+1][s+2][s+3]

Why the beginning of a downward stack is [s+3], not [s+2]?
If it's a upward stack, is beginning [s] or [s-1]?

Thanks.



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net