Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


IF problem in C++

Posted on 2013-07-01
Medium Priority
Last Modified: 2013-07-02
I've a problem with this IF sentence in Visual Studio 2010 C++:
      if (dataAligV!=0)

If I run the program in Debug Mode it works fine and does'nt execute the "objPT=" sentence but in release mode (with the same input data)  it doesn't work.

In release mode, if I add some code to do a txt trace, it also works fine. I know it could be a hard issue to solve, but I would appreciate if anyone can help me.

tks in advance,
Question by:leorocha
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
LVL 20

Accepted Solution

n2fc earned 2000 total points
ID: 39291668
If the results vary like that, probable cause is an uninitialized variable...

Try setting an initial value for "dataAligV" when you declare it...
LVL 59

Expert Comment

by:Julian Hansen
ID: 39291781
So you are saying if you put something here
 if (dataAligV!=0)
   // Dump dataAligV here

Open in new window

It works the way you want to?

Author Comment

ID: 39291820
Yes, JulianH. Also if no code is inserted but in DEBUG MODE works fine. The problem arises when I build the code in RELEASE MODE. It's hard to solve...

For more info, it is a WIN32 project creating "int __stdcall fnCreateCardEx" and exporting to be used by an VB6 ActiveX. This function do some graphic printing over plastic cards using WINGDI
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.


Author Comment

ID: 39291823
n2fc, I've checked that a hundred times (but I'will do this again). All variables are initialized.

Author Closing Comment

ID: 39293533
tks n2fc, in 101 try I've found the problem. The variable was initialized but not in the correct way in VB6 ActiveX
LVL 20

Expert Comment

ID: 39293925
Glad I was able to help!

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The following diagram presents a diamond class hierarchy: As depicted, diamond inheritance denotes when two classes (e.g., CDerived1 and CDerived2), separately extending a common base class (e.g., CBase), are sub classed simultaneously by a fourt…
In Easy String Encryption Using CryptoAPI in C++ ( I described how to encrypt text and recommended that the encrypted text be stored as a series of hexadecimal digits -- because cyphertext may…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

660 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question