Browse DevX
Sign up for e-mail newsletters from DevX


Retrieve a Function's Name Programmatically

Embedding a hard-coded string inside a function's body in order to retrieve that function's name can be tedious and bug-prone. Learn how to use a new C99 facility to obtain the function's name at runtime.




Building the Right Environment to Support AI, Machine Learning and Deep Learning

bject reflection libraries, debugging tools, and code analyzers often need to access functions' names at runtime. Until not long ago, the only portable way to accomplish this was to manually embed a hard-coded string with the function's name inside the function's body. Needless to say, this technique is very tedious and bug-prone. This article demonstrates how to use a new C99 facility to obtain a function's name at runtime.

How can you access the name of a currently executing function programmatically?

Use the __FUNCTION__ facility and its related macros.

Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date