2014-09-19 16:19 GMT+08:00 Oliver Kowalke
boost.context is low level and the design decision was that higher level libraries using boost.context have to take care about the stack, e.g. boost.context is not responsible for allocating/deallocating the stack.
I know boost.context is low level, and I don't expect it to alloc/dealloc the stack, what I proposed is: ```c++ fcontext_t BOOST_CONTEXT_CALLDECL make_fcontext_portable(void* sp, std::size_t size, void (*fn)(intptr_t)) { #if STACK_GROWS_UPWARD return make_fcontext(sp, size, fn); #else return make_fcontext(sp + size, size, fn); } ... char stack[1024]; // works for both downward/upward stacks auto ctx = make_fcontext_portable(stack, 1024, f); ``` Does that make sense? Is it possible to embed the logic in asm so you don't have to use preprocessor condition at all? Thanks.