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.
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"