The final word on GOTO

Rahul Dhesi dhesi at sunscreen.UUCP
Fri Oct 13 17:11:17 AEST 1989


In article <566 at sunquest.UUCP> ggg at sunquest.UUCP (Guy Greenwald) writes:
>/* Really: */
>	case whatever:
>		special-code...;
>		goto common;
>/* Is no clearer than: */
>	case whatever:
>		special-code...;
>		common();
>		break;

Possible counter-example:

   int counterexample(...)
   {
     ... other stuff ...

     switch (yyy) {
       case x:
          ... other stuff ...
	  goto err_ret;
       case y:
	  ... other stuff ...
	  goto err_ret;
       case other-stuff:
	  ... other stuff ...
	  break;
	  ...
       }

       return 0;		/* no need to close file;  return success */

     common:
       errno = last_error;/* save latest error for caller's sake */
       if (last_error != CE_NOFILE)
         fclose(f);		/* close file if still open */
       return -1;		/* return error code */
   } /* counterexample() */

Rahul Dhesi <dhesi%cirrusl at oliveb.ATC.olivetti.com>
UUCP:  oliveb!cirrusl!dhesi



More information about the Comp.lang.c mailing list