473,788 Members | 3,057 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Why the results of debug and release version is different.

Hi,
I create a project with vs2005 (both c++ and c# are used, sames the
problem is about c++) and it working well in Debug version but the
result is wrong in Release version. I checked again and again and no
difference of logic is found between two versions. I'm confused and
don't known how to correct it. Is there anyone encountered similar
deed? Any tips is wellcome.

Regards.

Bai Xiaoliang.

Sep 9 '06 #1
6 5910
bantamweight wrote;
I create a project with vs2005 (both c++ and c# are used, sames the
problem is about c++) and it working well in Debug version but the
result is wrong in Release version. I checked again and again and no
difference of logic is found between two versions. I'm confused and
don't known how to correct it. Is there anyone encountered similar
deed? Any tips is wellcome.
You have a bug. The bug has different symptoms in both builds.

Either post some code, or add unit tests to your code, or write it again
without the bug (not a joke), or post this question to
news:microsoft. public.vc.langu age .

--
Phlip
http://www.greencheese.us/ZeekLand <-- NOT a blog!!!
Sep 9 '06 #2
ba**********@gm ail.com schrieb:
Hi,
I create a project with vs2005 (both c++ and c# are used, sames the
problem is about c++) and it working well in Debug version but the
result is wrong in Release version. I checked again and again and no
difference of logic is found between two versions. I'm confused and
don't known how to correct it. Is there anyone encountered similar
deed? Any tips is wellcome.
You maybe misused the assert() macro (aka ASSERT, _ASSERTE or whatever
your compiler provides you additionally).

Or maybe you have used some LOG macro, which is defined differently for
_DEBUG and NDEBUG preprocessor options?

This way the logic _looks_ the same, but it isn't. Some tip for
debugging: try to find out _when_ the error occurs. This is simple
with some traces, it's probably much work with single-step-debugging,
though. Then you should not have to search all the sources, but just
look at the last correct function.
best regards,
-- Markus
Regards.

Bai Xiaoliang.
Sep 9 '06 #3
ba**********@gm ail.com wrote:
Hi,
I create a project with vs2005 (both c++ and c# are used, sames the
problem is about c++) and it working well in Debug version but the
result is wrong in Release version.

A common behavior with debug versions is to set automatic variables,
something that's not required by the standard and is usually not done
in release modes (for whatever "debug" and "release" modes mean in a
particular implementation) .

You mave have an uninitialized variable somewhere. It's hard for us to
tell without code. Reduce it to the smallest possible program that
still demonstrates the problem and post it. In reducing it, you
pinpoint the error on your own.

Brian
Sep 9 '06 #4
Hi,
Thanks for all kindly answers.
The problem is caused by my negligence.
My solution including several projects, yesterday, I moved one header
file which including template classes from project A to B and corrected
implemention of the template classes. I only build the release verion
of the solution without clean solution first. Thus the wrong result is
gotten. And after clean the solution firstly before build the
solution(or rebuild), every thing is right.

Regard.

Bai Xiaoliang

Sep 10 '06 #5
Markus Grueneis wrote:
ba**********@gm ail.com schrieb:
>Hi,
I create a project with vs2005 (both c++ and c# are used, sames the
problem is about c++) and it working well in Debug version but the
result is wrong in Release version. I checked again and again and no
difference of logic is found between two versions. I'm confused and
don't known how to correct it. Is there anyone encountered similar
deed? Any tips is wellcome.

You maybe misused the assert() macro (aka ASSERT, _ASSERTE or whatever
your compiler provides you additionally).
Or most likely he is using free'd or unitialized memory. In debug
mode the Visual Studio runtimes fills free'd and uninited memory with
a distinctive hex pattern. It also puts guard areas around memory
allocations. In release it doesn't do any of this which so you
can get quite different behavior.
Sep 10 '06 #6
Ron Natalie schrieb:
Markus Grueneis wrote:
>ba**********@gm ail.com schrieb:
>>[...]

You maybe misused the assert() macro (aka ASSERT, _ASSERTE or whatever
your compiler provides you additionally).
Or most likely he is using free'd or unitialized memory. In debug
mode the Visual Studio runtimes fills free'd and uninited memory with
a distinctive hex pattern. It also puts guard areas around memory
allocations. In release it doesn't do any of this which so you
can get quite different behavior.
Yes, this has bitten me also several times when maintaining some old or
otherones code. Nothing less common than some buffer which is too
small, and just happened to not chrash because of.. pff... luck?

I've encountered similar problems when porting some code from vc6 to
vc8. The more aggressive optimization in the newer version sometimes
also brought some waiting buffer overflows to light, and then you just
sit there thinking "but that was said to be working for 3 years now!".
-- Markus
Sep 10 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
3294
by: Raphael Zulliger | last post by:
Hi I have to check wheter a .py script is run within the debug or the release version of an embedded python interpreter (in short, wheter python24_d.dll or python24.dll is in use). long version: I'm using ctypes to load my own dll. There exists 2 version of this dll - a debug and a release version (where one is linked against debug C runtime dll and the other to release C runtime dll). Now I have to change the name of the dll I want...
5
1364
by: arber | last post by:
Hi, I wrote a C++ program(Using VC 6.0). It's run well under debug environment. After i finished it and made a release version. The different results are outputed. Anybody have this experience? I guess that's because the optimized compiling in the release version. How can i do?????? :-( Really thanks for your help.
2
3959
by: Scott Yost | last post by:
I reference a .NET DLL to import some of my custom types. I can build that DLL in debug or release mode, but I usually keep the debug one built so I can debug it. When I want to link to the release version of the DLL, I find that I have to remove the reference from the project and point VS. NET to the release version of the DLL. Is there some way to do this automatically, like it usually done in the past, so that the release/debug switch...
9
2001
by: dee | last post by:
Hi I'm about to upload my site and I have switched to release version. Is that enough or do I still need to disable <compilation defaultLanguage="vb" debug="true" /> the debug="true" in the .pdb file? Is the .pdb necessary for the release version? Thanks a bunch. Dara
3
2201
by: | last post by:
Since I need to dotfuscate my exe file anyway, does it make any difference if I use Debug or Release versions. Would a Debug version be easier to decompile/study/reverse engineer than a Release version, both having been dotfuscated by the standard dotfuscator of visual studio 2003 ? Tia
1
2158
by: Dan Maharry | last post by:
A few weeks ago, I upgraded an XML server of ours to .NET 2.0. All went fine. Then last week, I decided to remove all obsolete calls from the app and sign each project in the solution in the .NET 2 way so that the app compiled with no warnings. This built fine but we noticed that server was deserializing one of our XML messages incorrectly. I confirmed via source control that neither the schemas themselves nor the classes representing the...
3
1343
by: bantamweight | last post by:
Hi, I create a project with vs2005 (both c++ and c# are used, sames the problem is about c++) and it working well in Debug version but the result is wrong in Release version. I checked again and again and no difference of logic is found between two versions. I'm confused and don't known how to correct it. Is there anyone encountered similar deed? Any tips is wellcome. Regards.
2
2377
by: Epetruk | last post by:
Hello, I have a problem where an application I am working on throws an OutOfMemoryException when I run it in Release mode, whereas it doesn't do this when I am running in Debug. The application is developed using C++/Managed C++ and built using VS 2003 under .NET framework 1.1. In Debug, it uses of up to 600Mb of memory, whereas in Release it only gets
1
1370
by: =?Utf-8?B?Y25pY2ts?= | last post by:
i'm using VS 2005 / C# / WinXP pro SP2 / .NET Framework 2.0 I'm dealing with a problem I just can't figure out. I have a MDI application with two different types on Child windows. As means of data transfer between the Child windows I implemented a Drag And Drop like functionality. Part of that is that the cursor changes to different icons depending of what type of Child window it is hovering over. As long as I start the debug or release...
0
9655
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10363
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10172
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10110
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7517
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5535
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4069
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3670
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.