[flashrom] [RFC] Coding style limits

Uwe Hermann uwe at hermann-uwe.de
Thu Dec 17 11:10:04 CET 2009


On Wed, Dec 16, 2009 at 09:23:44AM +0100, Luc Verhaegen wrote:
> > > I only knew that dot matrix printers and old computer terminals used the 80
> > > columns-width. I didn't know that its a standard from the 1890s. Thanks Ron.
> > 
> > Apologies, I was wrong, it only goes back to 1928 :-)
> > 
> > But we sure don't want to limit ourselves to an 80-year-old standard :-)
> > 
> > ron
> Well, i personally try to stick close to the 80char standard, but i am 


> not religiously stuck to it, as was witnessed in the board enable table 
> discussion.
> I prefer sticking to 80 chars where it does not hurt, and it should be 
> trivially possible to stick to 80 chars in most cases. Not sure what 

I fully agree.

> exact line causes this now, but i am sure that it can be solved: strings
> can be broken up trivially, and we should all by now be used to broken 
> up strings.


There is nothing historic about this limitation. My console is still
80x25 (and yes, I do use it for coding from time to time), and all my
xterms are also 80x25 when I work in X11 (using vim in an xterm), so
I'm strongly in favor of trying to keep the 80 chars limit where
possible (and also keeping indentation to one tab, as per coding style).

Also, as the coding style document we follow (the Linux one) states very
nicely, if you need more that 80 chars per line, that's usually a good
indicator that the code is nested too much and should be refactored.
I fully agree with that statement.

Of course there are exceptions (overly long printf's that cannot be
wrapped nicely, or the board-enable table), that's fine. We can live
with a few exceptions that make sense. But as a general rule I'm
strongly in favor of sticking to 80 chars.

I also wouldn't object a patch which makes our prints shorter, e.g.



  printf(MSG_DEBUG, "Foo");


  printk(DBG, "Foo")


  // d for DEBUG, i for INFO, e for ERROR

or something like that (just an example, maybe someone can come up with
a good name).

http://www.hermann-uwe.de  | http://www.randomprojects.org
http://www.crazy-hacks.org | http://www.unmaintained-free-software.org

More information about the flashrom mailing list