Reply to post: Re: Goto? What about longjmp()

You've seen things people wouldn't believe – so tell us your programming horrors

Sam Liddicott

Re: Goto? What about longjmp()

And don't capture a well defined set of any state.

Variables temporarily in a register (and pushed onto the stack) when longjmp occurs from some deeper function will have some stale value and not the value they seemed to hold when you called setjmp; so all variables you plan to use after longjmp should be declared volatile which is easy to forget.

If only all variables were evicted from registers before the call to setjmp - but what implementation does that?

Better to be quickest than right, apparently.

POST COMMENT House rules

Not a member of The Register? Create a new account here.

  • Enter your comment

  • Add an icon

Anonymous cowards cannot choose their icon