Login | Register   
LinkedIn
Google+
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


Tip of the Day
Language: C++
Expertise: All
Jul 31, 1998

Pre-Defined Macros

All C/C++ compilers define the following macros:
 
__DATE__ //a literal containing the compilation date in the form "Apr 13 1998"
__TIME__ //a literal containing the compilation time in the form "10:01:07"
__FILE__ //a literal containing the name of the source file being compiled
__LINE__ //a decimal integer containing the current line number in the source file
In addition, a C++ compiler defines the following macro:
 
__cplusplus  //useful for combining  legacy C code with C++
And an ANSI conforming C compiler defines the following macro:
 
__STDC__ //useful when one has to test whether the current compiler is ANSI C compatible
These macros can be useful for debugging and issuing diagnostic messages:
 
if(isSuccessful == false)
{	
 printf("failed to open transaction; error occurred at line %d in file %s", __LINE__,__FILE__);
}
Danny Kalev
 
Comment and Contribute

 

 

 

 

 


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

 

 

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