As far as I know, ucontext offers something better then setjmp. But it's deprecated and now removed from the POSIX spec. So why did it appear and why was it removed?

有帮助吗?

解决方案

The signature of makecontext from ucontext.h is:

void makecontext(ucontext_t *ucp, void (*func)(),
       int argc, ...);

Note that func uses an empty parenthesis as argument, but this is a deprecated feature in standard C:

C11(ISO/IEC 9899:201x) §6.11.6 Function declarators

The use of function declarators with empty parentheses (not prototype-format parameter type declarators) is an obsolescent feature.

This is the reason it's deprecated (and somehow unfortunate).

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top