質問

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