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
Home » Tip Bank » C++
Language: C++
Expertise: Intermediate
Jan 29, 2003

WEBINAR:

On-Demand

Application Security Testing: An Integral Part of DevOps


Handling Release-only Bugs


Sometimes a program crashes or simply misbehaves on release builds. This is very frustrating because usually you have to ship the optimized release version. The most common reason for this phenomenon is that some code is executed in _DEBUG mode only. This can happen if you place some important code inside the #ifdef block:
 
#ifdef _DEBUG
m_nInportantGuy = 0; // oops
#endif

Sometimes, you might have placed code with side effects within an ASSERT or TRACE statement:
TRACE("My file : %s", OpenAndGetFileName());
Since these statements vanish in release build, you will get different behavior. The way to avoid these problems is to pay attention and do the important stuff before calling the TRACE or ASSERT:
 
const char * sFilename = OpenAndGetFilename();
TRACE("My file : %s", sFilename);
Gigi Sayfan
 
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