Hacker News new | ask | show | jobs
by drivebycomment 2584 days ago
That is a reasonable heuristic but your statement is not technically correct. E.g. you need volatile around setjmp/longjmp and that has nothing to do with IO.
2 comments

And if your GC doesn't dump the registers. Only with volatile you can keep all locals on the stack.

And yes, that's not stupid. It's actually faster than all the register "optimizations" for practical use cases in fast VM's. Register saving across calls and at the GC is much more expensive. mem2reg is an antipattern mostly

GC (of the kind where an external context walks other thread machine stacks) definitely falls under implementation-defined :-).
Technically for sig_atomic_t as well. Both are... messier parts of the C abstract machine.