[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: OT: Why is C so popular?



On Thu, 2003-08-28 at 21:54, Alex Malinovich wrote:
> On Thu, 2003-08-28 at 14:50, Steve Lamb wrote:
> > On Thu, 28 Aug 2003 16:35:25 +0200
> > Francois Bottin <fbottin@free.fr> wrote:
> > > Compare it with SUN's recomendations for Java (but useable also for C):
> > > if (cond) {
> > >     block;
> > > } else {
> > >     block;
> > > }
> >  
> > > In this case I find it much better than the GNU Coding Standards, and there
> > > is only one line more than Python...
> > 
> >     Except the else does not line up with the if and it is too easy to skip
> > over that line with your eyes and miss what it is.
> 
> Actually, that's exactly my preferred coding style. The closing brackets
> always line up with what they're closing. Using the long approach of
> 
> if (cond)
> {
>     block;
> }
> else
> {
>     block;
> }

BSD or Allman (since he did it at UC-Beserkeley) style.

> Has the same effect, but that's way too much wasted space.
> 
> I think it all just boils down to personal preference and what people
> can see most easily. I can easily pick out an } else { while my eyes get
> confused with having to line things up over long vertical distances.

I solved that problem by putting my VT220 emulator in 132x48 mode!
When I use xterms, I just make them nice and long.

> Other people have the opposite problem. I think people should just use
> whatever they're most comfortable with that's possible in their
> environment. (e.g. I don't think it's possible to do a } else { line in
> python even when using comments because you'd have comment code comment
> on one line)

I wouldn't be surprised if most Python programmers prefer BSD style.

-- 
-----------------------------------------------------------------
Ron Johnson, Jr. ron.l.johnson@cox.net
Jefferson, LA USA

"Our computers and their computers are the same color. The 
conversion should be no problem!"
Unknown



Reply to: