> But why should I have to type the particular value several times?
> What if I change the name of the function later?  Isn't that what
> variables are for?

Not variables named __func__.  That's just disgusting.  Sorry.

> Nah, even simple function calls can use it.
> 
>    check(a, b, c, __func__);
> 
> It's true, it would be nice to find out the caller from within check(),
> but this achieves most of the utility with a much simpler implementation.

The Plan 9 C libraries already provided a mechanism
for finding the caller - getcallerpc(2).  And almost all
the times I want to print the caller it's while debugging
some commonly called library routine, where it's impractical
to change all the call sites.

Russ

Reply via email to