4 ms·
POSIX.1 permits pthread_cleanup_push() and pthread_cleanup_pop() to be implemented as macros that expand to text containing '{' and '}', respectively.
by Joker_vD 6y ago
POSIX.1 permits pthread_cleanup_push() and pthread_cleanup_pop() to
be implemented as macros that expand to text containing '{' and '}',
respectively.
I'm sorry, what? Why would you permit that?
On Linux, the pthread_cleanup_push() and pthread_cleanup_pop()
functions *are* implemented as macros that expand to text containing
'{' and '}', respectively. This means that variables declared within
the scope of paired calls to these functions will be visible within
only that scope.
Yeah, and people call me a joker. But I wouldn't manage to invent this even if I tried to.
- qsort 6y agoTo be fair that particular example isn't as terrible as it looks because that's (generally) the intended behavior. But yeah, this is the type of arcane bullshit that comes up all the times in system-level C programming. C is a great language, but the environment you find yourself programming in is layers upon layers of barely intelligible nonsense that nobody needs nor wants.