Login | Register   
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

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.


advertisement
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.

 

 

Sitemap