From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: To: 9fans@cse.psu.edu Subject: Re: [9fans] Good enough approximation for ape/pcc From: "Russ Cox" Date: Sun, 9 Apr 2006 18:04:35 -0500 In-Reply-To: <20060409215708.12577.qmail@g.galapagos.bx.psu.edu> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Topicbox-Message-UUID: 33ce3b0c-ead1-11e9-9d60-3106f5b1d025 > 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