Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!brutus.cs.uiuc.edu!apple!motcsd!hpda!hpcupt1!jamiller From: jamiller@hpcupt1.HP.COM (Jim Miller) Newsgroups: comp.lang.c Subject: Re: if (e1) return e2; [else] s1; Message-ID: <5940028@hpcupt1.HP.COM> Date: 27 Mar 90 20:44:49 GMT References: <887@dino.cs.iastate.edu> Organization: Hewlett Packard, Cupertino Lines: 55 >void foo(struct spam *bar) > { > if (bar->bletch != NULL) > { > printf("Ve haf a bletch!\n"); > } /* if */ > else > { > bar->bletch = 6; > printf("We have one NOW!\n"); > } /* else */ > return; > } /* foo() */ > >The point I am most interested in is the indentation of the entire function, >including opening and closing braces. Does this strike people as possibly >confusing? I find it clearer, and consistant (ie, every sub-block gets >indented, as do its opening and closing braces). I feel the final /* foo () */ >makes it obvious that we're at the end of a function, not one level in... >but what do others feel? My style is: void foo(struct spam *bar) { if (bar->bletch != NULL) { . . . } . . . return; } /* foo */ which makes procedure {} inconsistant with all my other {}'s. However, it's so vi's "[[" and "]]" commands can find them. I indent the procedure body so procedure declaration and other global declarations visually stand out. > >Thanks... > > -Chris You're welcome. jim P.S. >After all, while and until >and for are also funny ways of spelling goto... > Ron So is "if" :-)