Date: Sat, 23 May 2009 11:40:45 +0000 (UTC) From: "Bjoern A. Zeeb" <bzeeb-lists@lists.zabbadoz.net> To: Bruce Evans <brde@optusnet.com.au> Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, Sam Leffler <sam@FreeBSD.org>, src-committers@FreeBSD.org Subject: Re: svn commit: r192591 - head/sys/fs/nfsserver Message-ID: <20090523113511.N72053@maildrop.int.zabbadoz.net> In-Reply-To: <20090523210556.Y826@delplex.bde.org> References: <200905221810.n4MIAe4J014419@svn.freebsd.org> <20090522184846.GA34437@FreeBSD.org> <4A16F40B.4020404@freebsd.org> <20090523210556.Y826@delplex.bde.org>
next in thread | previous in thread | raw e-mail | index | archive | help
> On Fri, 22 May 2009, Sam Leffler wrote:
>
>> I requested the printf identify the call site; e.g.
>>
>> printf("%s: out of clientids\n", __func__);
>
> That is equally cryptic _with_ grepping through the source code, and
> much uglier. __func__ should only be used when the function name is
> not a literal constant (mainly in macros).
Even if I am going to regret this: I strongly say "NO" here.
Using __func__ in printfs helps for a lot of things. Let me tell you
the three that mostly annoyed me over the last months, constantly
tripping over:
- people move code from one function to another and do not update all
the printfs. __func__ does that for you.
- people copy and paste code and do not update the printfs and old
function names, sometimes entirely unrelated, even in KASSERTs, stay.
__func__ does not have that problem.
- if I want to find function definitions and function calls using gre
I do not want to find 47 printfs with the function name as well.
__func__ does not show up in grep.
I strongly vote for using __func__ in printfs!
--
Bjoern A. Zeeb The greatest risk is not taking one.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20090523113511.N72053>
