on-internet
← Community

Is it possible to get a pointer to the current function using a macro in C?

Stack Overflow ·

Is there a C macro that gives you the current function pointer (not the string name)? Something like: void scheduleEvent(void *func) { ... } void doSomething() { ... scheduleEvent(__FUNC_PTR__); } Or, more to the point, something that could be used in a macro: #define scheduleCurrentFunc() scheduleEvent(__FUNC_PTR__) void doSomething() { ... scheduleCurrentFunc(); }

Comments

Sign in or sign up to comment and upvote.

No comments yet.