Dan Cross <crossd(a)gmail.com> once said:
I'm told that the plan9 C compilers were
callee-save in part to keep
these state labels svelte.
The Plan 9 compilers are caller-save. That means the labels only have
to contain pc and sp. Waserror works well except for one small issue
involving whether or not the compiler decides to store a value to a
non-volatile, non-pointer variable when the value would not be used
after a function call. As in:
int a;
a = 1;
if(waserror()){ /* ... */ }
a = 2;
a = foo(a);
The waserror branch may see a == 1 if foo errors.
Ken's compilers are great, though. They don't engage in antisocial
optimizations based on dubious notions of undefined behavior. I'd
prefer my compiler to not elide explicit null checks or loads and
stores from a pointer.
Cheers,
Anthony