On Tue, 20 Feb 2001 14:51:43 +1100 (EST), Jason Rennie wrote:

>I guess i'm a sloppy programmer then, i stick exit()'s in code when I have
>some nasty fail error, sinply becasue it is easy to see where it was up
>to, and the exits live with the broken peice of code :)

Well here is one circumstance where (IMO), it is quite OK to have
gotos,

viz:

afunction()
{
   int ret = 0;

   switch(whatever)
   {
      case x:
      if((ret = dosomething()) == 0 )
         goto fail;
      case y:
      if((ret = dosomethingelse()) == 0)
        goto fail;
   }

fail:
   return(ret);
} 


gotos should be used when they make sense, I reckon they definately
have their place.

Regards


-- 
SLUG - Sydney Linux User Group Mailing List - http://slug.org.au/
More Info: http://slug.org.au/lists/listinfo/slug

Reply via email to