Re: [v4l-dvb-maintainer] [PATCH 3/3] V4L: cinergyT2, remove bad usage of ERESTARTSYS

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Michael Krufky <mkrufky@...>
Cc: <video4linux-list@...>, Jiri Slaby <jirislaby@...>, <daniel@...>, <linux-kernel@...>, <holger@...>, v4l-dvb maintainer list <v4l-dvb-maintainer@...>, Andrew Morton <akpm@...>
Date: Wednesday, October 10, 2007 - 11:35 am

Em Qua, 2007-10-10 às 00:18 -0400, Michael Krufky escreveu:

Yes, it is. CodingStyle states:

"Don't put multiple statements on a single line unless you have
something to hide"
	and
"Don't put multiple assignments on a single line either.  Kernel coding style
is super simple.  Avoid tricky expressions."

So, Kernel's script/checkpatch.pl is right when complaining about it.



Yes, this is a great C feature, especially to obfuscate a source code.
On C, it is possible to write very complex code, with several
statements, on a single clause, like:

if((c=(a=x,x-=c,++a)>6?1:-1)>0)goto foo;

The above code is valid under C, and won't produce a single compiler
warning. An experienced C programmer will understand the above code,
while non-experienced ones, even with large experience on other
programming languages, may take hours to understand.

A large code, with lots of the above style will be very painful to
analyze, even for advanced programmers. So, especially on big projects,
with lots of contributors, this should really be avoided. 


It is just a matter of a simple CodingStyle fix.

The proper fix is just to replace the offended code by this:

err=foo();
if (error)
	goto error;

-- 
Cheers,
Mauro

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

Messages in current thread:
Re: [PATCH 3/3] V4L: cinergyT2, remove bad usage of ERESTART..., Mauro Carvalho Chehab, (Tue Oct 9, 9:21 pm)
Re: [v4l-dvb-maintainer] [PATCH 3/3] V4L: cinergyT2, remove ..., Mauro Carvalho Chehab, (Wed Oct 10, 11:35 am)
Re: [v4l-dvb-maintainer] [PATCH 3/3] V4L: cinergyT2, remove ..., Mauro Carvalho Chehab, (Wed Oct 10, 12:17 pm)