Reply to post: Re: Beastly, Just Beastly

'Boss, I've got a bug fix: Nuke the whole thing from orbit, rewrite it all'

Anonymous Coward
Anonymous Coward

Re: Beastly, Just Beastly

gotos are not evil per se, are surely evil the way they were used in the early version of BASIC, when you had no other way to invoke different parts of code. In plain C, they could be useful if properly used. Some instructions like break/continue are actually very much alike gotos (they are unconditional jumps to a given location, albeit implicit), and in some ways exception handlers are also (although with a far better semantic and stack-unwinding capabilities). IMHO in C using goto *inside* a function to jump to error handling code is acceptable - if done properly. Other uses are usually just crazy.

Just don't mix semantic - if {0} is just a "smart" trick for another goto, just with an implicit meaning instead of an explicit one.

Otherwise you could make like an ex (luckily) colleague of mine, that resolved the issue of error handling just calling exit(1) every time he encountered an error... in a multithreaded application...

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