[vtk-developers] style : Holiday greetings and a present of VTK4.0

Sebastien BARRE sebastien at barre.nom.fr
Thu May 24 19:03:42 EDT 2001


Let's add my 0.0198 Euro.

At 24/05/2001 18:46, David Gobbi wrote:

>Use spaces for god's
> > sake, they are always the same size.
>
>A good idea, but a little hard to enforce.  I don't mind tabs as long as
>they are every 8 chars (which is, as far as I know, the standard).

Well, I don't mind tabs as longs as they are every 4 chars, which is my 
settings in Emacs.

>  So
>far I've had very little trouble with bad indentation in VTK code, though

Me too, which means that setting the tab length correctly seems to make 
both of us happy :)
Anyway, I guess I've set "use space instead of space" in my VTK Emacs style.

>I agree with you here: I really like the
>if (condition) {
>   do something;
>}

Oh yes, I love that one too, and this is also my major (and indeed unique) 
grief against the VTK indentation style (it wastes too much vertical 
space). My arguments are :
         - John's + David's arguments :)
         + this *is* the way to go in Perl indentation :)
         + you *have* to use that style for Tcl scripts, because it's part 
of the syntax.
         => I'm tired of multiplying my indentation styles :)

>style because it saves space and tightly connects the 'do something' with
>the 'condition,' however I don't like
>if (condition)
>   do something;
>because, in C, I like to have all blocks {} delimited.

And you are perfectly right, because any experienced C programmer how bad 
this :
         if (condition)
          do something;
is. This is a common pitfall and you will definitely fall into it if you 
use VTK, because most VTK macros are not capitalized (as they sometimes are 
in other toolkits) and look as if they were regular functions, thus :
         if (condition)
          use a function which is indeed a macro that is more than one 
statement;
will kill you.

>Blank lines should still be used to separate out
>code segments from one another (approx. one blank line per
>five code lines seems about right for me).

I definitely support that, this is lacking in many VTK source files. I'm 
trying to add some blank lines from time to time, without being caught :)





More information about the vtk-developers mailing list