[BusyBox] Re: ifconfig: Clean up. [PATCH]

Rob Landley rob at landley.net
Mon Jul 25 20:52:37 MDT 2005


On Monday 25 July 2005 21:00, Rob Landley wrote:
> On Monday 25 July 2005 09:08, Tito wrote:
> > From busybox/docs/style-guide.txt:
> >
> > Brackets Are Your Friends
> > ~~~~~~~~~~~~~~~~~~~~~~~~~
> >
> > Please use brackets on all if and else statements, even if it is only one
> > line. Example:
> >
> >  Don't do this:
> >
> >   if (foo)
> >    stmt1;
> >   stmt2
> >   stmt3;
> >
> >  Do this instead:
> >
> >   if (foo) {
> >    stmt1;
> >   }
> >   stmt2
> >   stmt3;
> >
> > Ciao,
> > Tito
>
> Wow.  That sucks deeply.  I hadn't seen that before...
>
> Rob

Actually, what that _seems_ to be saying is:

If you have to split an if statement into two lines, you might as well put the 
brackets in.  I.E.

This is ok:

if (thing) do_something();

But this:

if (thing)
  do_something();

Might as well be this:

if (thing) {
  do_something();
}

And that I have no problem with.

Rob


More information about the busybox mailing list