Pregunta

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?

¿Fue útil?

Solución

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

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top