ol************@ gmail.com wrote:
This is not true
/What/ is not true?
After a return statement no code is executed it the function
So don't post these silly things.
You might try and understand what the OP is asking before you
brush them off like that.
The OP asked:
If I have code like this
int f() {
// ... stuff ...
g();
if(x > 0) return (x+4);
// ... more stuff ...
always_call(z);
return y;
}
can I insure that always_call will be called even when the conditional
(x > 0) succeeds and when g() might contain non-local jumps?
The answer is that, no, in C you can't do that, except by doing it
all "by hand"; you must be able to trap any non-local jumps out of
g (which you have to do with the connivance of g and everything it
calls that might longjump) and you have to arrange that always-call
is executed before every return. In C++ the compiler handles this
for destructor code; in C you have to /be/ that compiler (without
the advantage of having total control over the generated code).
--
Chris "believes seventeen improbable things before coffee" Dollin
Seventeen, forty-two - what else is there?