Reply to post: Re: Goto Jail, go directly to jail.

'Disappearing' data under ZFS on Linux sparks small swift tweak

Lee D Silver badge

Re: Goto Jail, go directly to jail.

@Phil: Elaborate?

Because I'd like to see you set up a loop which performs an action and then tests for errors after without using/corrupting a register or two, putting in conditional jumps, making unwind-operations for failures more complex, and doing 4-5 instructions more than a "goto errorhandler", on even the most highly optimised of compilers.

An empty loop might compile to just a jmp the same as a goto, but any conditionals mean register management and shifting, which can have severe implications if you're deep in the middle of performance-critical, interrupt handler, etc. type code under a failure condition.

It seems that Linus and others agree with me:

http://koblents.com/Ches/Links/Month-Mar-2013/20-Using-Goto-in-Linux-Kernel-Code/

The example at the bottom is particularly relevant in terms of error-related rollback.

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

Biting the hand that feeds IT © 1998–2019