Is there any way to get a pointer to the current function, maybe through gcc extensions or some other trickery?
Edit I\'m curious whether it is poss
Looks like this has been asked before on SO, here is an interesting answer that I have not tested:
Get a pointer to the current function in C (gcc)?
Anyway, there are some interesting extensions, with gcc extensions, are you familiar with the __FUNCTION__ macro?
See what you think about this (this will just get you a string with the name of the function:
#include
#include
void printme(char *foo)
{
printf("%s says %s\n", __FUNCTION__, foo);
}
int main(int argc, char *argv[])
{
printme("hey");
return 0;
}