GCI Task review: breaking up long lines

Peter Dufault dufault at hda.com
Wed Dec 5 11:58:10 UTC 2012


On Dec 4, 2012, at 22:52 , Ralf Corsepius wrote:

> Yes, I don't see much sense in such undertaking, but stylishness.
> 
> It made sense 30 years ago, when people were programming on punch cards 
> and it made sense 20 years ago, when people were programming on vt100s, 
> but times have changed ...
> 
> When not carefully done, limiting line lengths to 80 chars is reducing 
> code readability and maintainability, and is likely to break code.

I've read the responses that came in up to when I'm sending this.  I'll chime in and say I agree with Ralf 100% on this one.

I personally enforce 110 columns, but I wouldn't object to 132 (to fit on the DECwriter).

I also agree with Sebastian about not jumping in on a white space project, at least not until settling other discussions of style.

FWIW I did do a style conversion as part of some work for a client of a large body of old C and C++ code that had been worked on by many different people of various capabilities for 25 years.  This included:

Deciding on the style;
Creating a conversion tool that converted to the defined style.  It was and is a combination of:
- Pre-and-post sed scripts;
- sunifdef ("A commandline tool for eliminating superfluous preprocessor clutter from C and C++ source files")
- a bison parser named "retypedef" to remove some particularly brain-dead typedefs but only when the parser could verify that it was a typedef;
- uncrustify.

Then the entire code base was crunched and built and we verified the binaries matched for all the variants supported.

Not really, they wouldn't agree but should have: Then the entire code base was converted at once.

Then an option was plugged into the VCS so that you could do diffs from before and after the big conversion by running the files being compared through the script before diffing.

Not really, they wouldn't agree but should have: Then the VCS should have been set to reject any commits that had differences before and after running through the script.

One annoying thing it couldn't handle was the mixed use of camelCase versus under_scores versus Random_Variable_namingConvention.

Peter
-----------------
Peter Dufault
HD Associates, Inc.      Software and System Engineering





More information about the devel mailing list