🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #3418

Re: GOTO single exit point (was: Re: How to eliminate GOTO?)

#3418
From: Lance Kibblewhite
Date: Wed, 13 Sep 1995 20:43
52 lines
1603 bytes
Silly contrived example without using multiple gotos nor nested if
statements.

void manipulate_the_windows(Window *top)
{

  void do_whatever_with (Window *A)
  {

     void do_whatever_with (Window *B)
     {

       void do_whatever_with (Window *C)
       {
          if (C)
          {
             do_something_weird_with_four_windows(top,A,B,C);
          }
       }

       if (B)
       {
         do_something_else_with_window(B);
         do_whatever_with(get_subwindow(B));
       }
     }

     if (A)
     {
       do_something_different_with_window(A);
       do_whatever_with(get_subwindow(A));
     }
  }

  if (top)
  {
     do_something_with_window(top);
     do_whatever_with(get_subwindow(top));
  }

  do_cleanup();
}


What do you mean 'C' doesn't have local functions!

Give me a real language with local functions, and a decent optimizer
anyday.



-- Lance.
Technical Details
Message-ID: <437fk4$5no@eco.twg.com>
Path: arc1-ca.pugleaf.net!eco.twg.com!news
References: <3vn1ht$kj8@martha.utk.edu> <41cke4$gtd@sparcserver.lrz-muenchen.de> <41glno$3a0@caip.rutgers.edu> <41iebe$kec@news0.rain.rg.net> <41pm80$skp@inferno.mpx.com.au> <DE02nC.B58@eskimo.com> <41t0sb$15e@news0.rain.rg.net> <DE6G2z.JJD@crdnns.crd.ge <42s5su$4h8@inforamp.net> <42u8sr$hv8@bud.shadow.net>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!eco.twg.com!news
From: lance@eco.twg.com (Lance Kibblewhite)
Newsgroups: comp.std.c,comp.lang.c
Subject: Re: GOTO single exit point (was: Re: How to eliminate GOTO?)
Date: Wed, 13 Sep 1995 20:43:48 GMT
Organization: Wollongong
Message-ID: <437fk4$5no@eco.twg.com>
References: <3vn1ht$kj8@martha.utk.edu> <41cke4$gtd@sparcserver.lrz-muenchen.de> <41glno$3a0@caip.rutgers.edu> <41iebe$kec@news0.rain.rg.net> <41pm80$skp@inferno.mpx.com.au> <DE02nC.B58@eskimo.com> <41t0sb$15e@news0.rain.rg.net> <DE6G2z.JJD@crdnns.crd.ge <42s5su$4h8@inforamp.net> <42u8sr$hv8@bud.shadow.net>
NNTP-Posting-Host: zaphod.eco.twg.com
X-Newsreader: Forte Free Agent 1.0.82