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

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.


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

WEBINAR:

On-Demand

Application Security Testing: An Integral Part of DevOps


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
×
We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.
Thanks for your registration, follow us on our social networks to keep up-to-date