Date: Tue, 23 Jan 2001 01:02:54 +0000 (GMT) From: Terry Lambert <tlambert@primenet.com> To: tl001@online.no (Tore Lund) Cc: freebsd-chat@FreeBSD.ORG Subject: Re: silly C style question Message-ID: <200101230102.SAA06571@usr08.primenet.com> In-Reply-To: <3A6C72DC.7F5F817@online.no> from "Tore Lund" at Jan 22, 2001 06:50:20 PM
next in thread | previous in thread | raw e-mail | index | archive | help
> > if (0 == i) > > { > > foo(i); > > bar(i); > > } vs. > > if (0 == i) { > > foo(i); > > bar(i); > > } [ ... ] > Unfortunately, there is no objective way to decide which style makes the > code easier to read. Take a look through the FreeBSD sources, and you > may realize what sort of flame war you have just started. At least this > is closer to topic than the discussion on mobile phones. Actually, I think style preference has a lot to do with the tools you use, particularly your editor. The second version lets me hit "$%" in vi, for example, to do a quick block skip, if the block of code in question is not of interest (e.g. if I knew 'i' was not zero). I have also seen a lot of "qed" users, who don't like the block spacing used: > > if (0 == i) { > > foo(i); > > bar(i); > > } And prefer: > > if( 0 == i) { > > foo( i); > > bar( i); > > } For similar editor usage reasons. As to comparing zero to 'i', instead of the other way around, well... }B^). Terry Lambert terry@lambert.org --- Any opinions in this posting are my own and not those of my present or previous employers. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-chat" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200101230102.SAA06571>