Re: Is 80-column source code formatting still standard ?

André Pang <[email protected]>
Newsgroups gmane.org.user-groups.slug.chat
Message-ID <[email protected]>
On 29/06/2008, at 1:12 PM, Daniel Pittman wrote:

>> I don't think it'll be hard to find cases where a 160-character line
>> is a lot more maintainable than trying to split it into 3 or 4 lines
>> of 50 columns each.
>
> I, personally, do, simply because I don't know of any editors out  
> there
> which are particularly intelligent about word-wrapping wide columns.
>
> You can break the expression into four lines by hand in a much more
> sensible way than an arbitrary 80 (or 90, or 100, all of which are
> common enough) column cut-off.
>
> That 80 column point may be half way between words, or in the middle  
> of
> a sub-expression, or any number of other bad choices.

I think you're assuming that I use 80 columns for my text editing  
width, which I typically don't.  I usually view around 160-200 columns  
when editing code, so word wrapping isn't a problem for most lines.   
(I'll restrict my margin to 80 columns when the coding standards for  
the project wants me to, of course.)

I think a more apt analogy than comparison with English text and  
newspapers is breaking up a long mathematical expression over three or  
four lines rather than keeping it on a single line: sometimes it's  
clearer; sometimes it's not.  My overall point is that the nature of  
what you're trying to convey in the code should be the biggest  
contributor to whether short or long lines work better, and it's not  
just about the optimal column width for reading.


-- 
% Andre Pang : trust.in.love.to.save  <http://www.algorithm.com.au/>

-- 
SLUG - Sydney Linux User Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html
smime.p7s (application/pkcs7-signature, 3.4 KB) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.