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

Prabhu Ramachandran prabhu at aero.iitm.ernet.in
Thu May 24 23:55:27 EDT 2001


hi,

Here are my 2 paise.

>>>>> "DG" == David Gobbi <dgobbi at irus.rri.on.ca> writes:

    DG> I agree with you here: I really like the if (condition) { do
    DG> something; } style because it saves space and tightly connects
    DG> the 'do something' with the 'condition,' however I don't like
    DG> if (condition) do something; because, in C, I like to have all
    DG> blocks {} delimited.  The trailing '}' on a line by itself
    DG> really helps my eyes to break the code into blocks.

This is pretty amazing, all of us seem to like this way of using
blocks.

if (condition) {
    do something;
}

This is my preferred style too.  I use expand (lazy programmer) and
have this in my c-expand-list

("if1" "if () {\n\n}" (5 9))

and use

(c++-mode-hook (lambda nil (setq c-basic-offset 4))

    DG> I also agree that generally - more code per screen is better
    DG> but I would also add - less code per line is better and then
    DG> things balance out nicely.  Blank lines should still be used
    DG> to separate out code segments from one another (approx. one
    DG> blank line per five code lines seems about right for me).

Yes, makes sense.

<snip>
    DG> I strongly disagree here.  To much code on one line makes the
    DG> code much harder to read.  Lines should be maximum 78 chars,
    DG> but shorter is even better.  The thought of using a
    DG> programming editor with a horizontal scroll... ugh.  Vertical
    DG> scroll only for me, please.

Absolutely! Although emacs automatically wraps lines it is a pain
having too long lines.  If the line gets very long I prefer using a
'\' and breaking the line.  This also makes it easy to print the code
on an 80 column printer (not that I like doing that).

prabhu




More information about the vtk-developers mailing list