[prog] C and curly braces - question of style?

Jenn Vesperman jenn at anthill.echidna.id.au
Tue Aug 24 00:02:44 EST 2004


On Mon, 2004-08-23 at 16:26, Akkana Peck wrote:

> I dislike code indented with tabs.  Why?  Because if I print it
> on a printer, or view it in a normal terminal, tabs display as
> eight spaces and the code becomes hard to read (and probably
> doesn't fit in 80 columns any more, so the ends of lines either
> wrap or disappear).

I'd never thought of that problem! Duuuuh. Now I feel guilty about it.
:(

> > You can even stick a line in your make file that formats code according
> > to the group's standard at compile time, just to make everyone happy
> > with a minimum of human effort. It'll take .. microseconds for the
> > computer to reformat things? Geee.....
> 
> Don't do that if you're working in a CVS repository!  It'll really
> mess up your CVS history when every file gets every line modified
> on every checkin, because each person makes whitespace changes
> every time they compile.
> 
> But Jenn, you're our CVS guru.  Are you assuming some CVS solution
> to this that the projects I've worked on aren't aware of?

If you have a 'commit only after you've compiled' thing, that isn't a
problem because the formatter only makes changes to the lines you've
modified anyway.
You can use the commitinfo file to check indentation before accepting a
commit, to be certain everyone's run the formatter and ensure that you
don't get the problem of Joe committing without having done it.

Well, depending on the formatter, I guess. There may be formatters which
change lines which haven't been editted.


Jenn V.
-- 
    "Do you ever wonder if there's a whole section of geek culture 
        	you miss out on by being a geek?" - Dancer.
   My book 'Essential CVS': published by O'Reilly in June 2003.
jenn at anthill.echidna.id.au     http://anthill.echidna.id.au/~jenn/




More information about the Programming mailing list