From: Paul Beardsley (beardsley_lists_at_[hidden])
Date: 2003-03-06 11:34:29
I have a question about coding style which maybe fits the list criteria of "technical discussion about a library'.
The Boost style guide recommends 80 column text without giving any justification for this. What is your opinion of this constraint?
The three supporting arguments I hear are
(a) It makes it possible to print code. Personally I never print code. I understand it might be useful given, say, 15 people in a room doing a code review but even then I think it would be better to bring in laptops and PCs and look at the electronic version. For one thing at least then everyone ends up with the same annotations.
(b) It makes it possible to do side-by-side comparisons of two slightly differing pieces of code. Occasionally I need to do a comparison but I really try to avoid it - there is something wrong if the development process keeps throwing up the need for a laborious (error-prone) manual comparison of pieces of code.
(c) Reading test over 80 columns makes your eyes tired, that's why typesetters traditionally converged on the 80 column solution. I think that reading highly-structured code is different to reading straight text, so I don't know if the lessons from straight text carry over.
My arguments for longer-than-80-column lines would be the following. These arguments apply specifically to header files -
(i) It's easier to parse a header file with one method per line. Longer lines make this more likely.
(ii) It's preferable to have inline method definitions with the declaration, for short methods. Longer lines again make this more likely.
(iii) The structure of the code throws up other cases where one method per line makes for readability e.g. overloaded methods benefit from being on consecutive lines so that the first part of the text corresponds directly and only the signatures differ.
The most powerful argument in favor of 80-column text is just that 'everyone does it', or that you cannot anticipate that somebody-somewhere might have a device that needs 80-column text. But these seem more like arguments by inertia and surely readability is more important. So I wondered what the general opinion of boost developers is on this issue,
Do you Yahoo!?
Yahoo! Tax Center - forms, calculators, tips, and more
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk