Re: [PATCH 109/148] include/asm-x86/serial.h: checkpatch cleanups - formatting only

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Ingo Molnar
Date: Tuesday, March 25, 2008 - 6:38 am

* Jörn Engel <joern@logfs.org> wrote:


you picked an borderline case without showing the full effects of your 
choice of style - but still even in this example you are wrong i 
believe. Look at how inconsistent this looks:

 	for (i=0; i<10; i++) {
		l = 10;
		if (k <= 10)
			k = 11;
	}

(the inconsistent 'i=0' versus 'l = 10')

so in your style we'd have to write it as:

 	for (i=0; i<10; i++) {
		l=10;
		if (k<=10)
			k=11;
	}

which, on one hand, looks unprofessional (in fixed width font), but on 
the other hand, the literals and operators are way too "close" to each 
other and operators are easily missed and mis-identified visually - 
causing bugs.

For example the 'k' and the '<=' operator may look visually similar and 
can be "blended", making it easy to skip over 'k=10' versus 'k<=10' - 
while 'k = 10' clearly stands apart from 'k <= 10'. [and syntax 
highlighting does not help with this particular problem]

in Documentation/CodingStyle it looks:

 	for (i = 0; i < 10; i++) {
		l = 10;
		if (k <= 10)
			k = 11;
	}

which is certainly reasonable and groups safely.

yes - you can have arguments one way or another, but there's nothing 
worse than maintainers each going towards their own _arbitrary_ and 
often clearly inferior coding style, which is inconsistent within the 
same file.

I at least make the point that i'm trying to converge to 
Documentation/CodingStyle. Is it arbitrary? Yes, to a fair degree, but 
it certainly conveys a very strong, unambiguous sense of taste.

	Ingo
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [PATCH 109/148] include/asm-x86/serial.h: checkpatch c ..., Ingo Molnar, (Tue Mar 25, 6:38 am)
Re: [PATCH 109/148] include/asm-x86/serial.h: checkpatch c ..., Paolo Ciarrocchi, (Tue Mar 25, 11:23 am)
[patch] bkl2mtd: cleanup, Ingo Molnar, (Wed Mar 26, 3:14 am)
Re: [patch] bkl2mtd: cleanup, Al Viro, (Wed Mar 26, 3:48 am)
Re: [patch] bkl2mtd: cleanup, Jörn, (Wed Mar 26, 3:57 am)
Re: [patch] bkl2mtd: cleanup, Ingo Molnar, (Wed Mar 26, 4:00 am)
Re: [patch] bkl2mtd: cleanup, Ingo Molnar, (Wed Mar 26, 4:02 am)
Re: [PATCH 109/148] include/asm-x86/serial.h: checkpatch c ..., Christoph Hellwig, (Wed Mar 26, 4:09 am)
Re: [patch] bkl2mtd: cleanup, Ingo Molnar, (Wed Mar 26, 4:10 am)
Re: [patch] bkl2mtd: cleanup, Jiri Slaby, (Wed Mar 26, 4:14 am)
Re: [patch] bkl2mtd: cleanup, Joe Perches, (Wed Mar 26, 9:30 am)