lkml.org 
[lkml]   [2003]   [Jul]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
Subject[RFC] single return paradigm
Hi,

The "single return" paradigm of drivers/char/vt.c:tioclinux() surprised
me at first glance. But I'm now trying to maintain a patch which adds
probes at entry and exit of functions for performance instrumenting, and
this paradigm is a great help, and on the other hand, maintaining the
patch for drivers/scsi/sg/sg_ioctl() is really a drudgery whenever a
little thing changes or a case is added... I don't know what people from
the linux trace toolkit think of this?

Gcc compiles every function into "one return form" anyway, so there's no
penalty in defining a retval variable, having it assigned, and doing a
break or goto out. I has been said to be of religious concern, but
having this habit keeps tracing patches simple. And if one needs, say, a
spinlock at entry & exit, the work is almost done. One could still have
a second exit for error cases, but no more.

Could this be added to CodingStyle or something?

Regards,
Samuel Thibault
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:47    [W:1.013 / U:0.016 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site