User not logged in - login - register
Home Calendar Books School Tool Photo Gallery Message Boards Users Statistics Advertise Site Info
go to bottom | |
 Message Boards » » Visual Studio .Net question. Page [1]  
r45t4-m4n
All American
629 Posts
user info
edit post

I have a question related to Visual Studio .Net. I have a program working fine in debug mode, however when I compile it in release mode it no longer works properly. Any ideas why this might occur?

10/23/2005 10:41:44 PM

Smoker4
All American
5364 Posts
user info
edit post

The basic reason is that Release Mode is not the same as Debug mode.

The code emitted is generally much more optimized in Release mode. If you're writing C++, for example, expect a few "sanity checks" to be omitted (debug mode redefines the heap allocation routines to DEBUG_NEW, etc, for example). Managed code will optimize the emitted IL.

Usually when you run into such problems, it's because you're doing something "unsafe" and Debug mode happens to let it fly. Your best bet is to just use the usual divide-and-conquer debugging tactics and figure out where the problem is.

[Edited on October 24, 2005 at 12:50 AM. Reason : foo]

10/24/2005 12:49:28 AM

DirtyHippy
New Recruit
49 Posts
user info
edit post

I am assuming you are doing C++. Usually, the main reason when debug mode works and release does not is plain old memory stomping. I.e. debug mode will pad memory allocations on either side with 0xcdcd so that the compiler knows when something has been stomped on (since this memory will be overwritten). However, this padding also means that it is possible that in debug mode you can stomp on stuff and everything still runs fine since this padding "soaks" it up. In release mode this padding goes away and when you stomp on something (overrunning array bounds, blah blah), you actually overwrite something important and you are done.

I haven't seen any cases in the managed world (i.e. .NET) where debug and release were different. Since the managed world is much different (and better) than C++, this is to be expected.

Why in god's name are people still using C++ anymore, anyway? It should be in a Smithsonian exhibit.

[Edited on October 26, 2005 at 11:57 AM. Reason : .]

10/26/2005 11:56:28 AM

ZeroDegrez
All American
3897 Posts
user info
edit post

Because C++ still has plenty of life left in it. Managed C++ on the other hand should be in a modern art exibit.

10/26/2005 3:22:09 PM

DirtyHippy
New Recruit
49 Posts
user info
edit post

Er I hope you didn't think I meant managed C++. When I say the managed world, I mean C# and ASP.NET.

And trust me on this, seriously, learn .NET. You will have a difficult time finding C++ jobs anymore except with legacy applications and graphics/games/high speed computing.

.NET is the future. Until you have immersed yourself in .NET for several years you don't realize how much better it is then the traditional C++/MFC combo that was one of the dominant forces in the workplace until about 2 years ago. I did C++ and MFC as a team lead for at least six years at various companies.

If I never see another line of C++ code again, I will be a very happy man. And even if I did, I would wrap it in managed .Net, interop to the sucker, and never look back.

10/26/2005 7:47:26 PM

r45t4-m4n
All American
629 Posts
user info
edit post

My code sends data over the serial port, it works flawlessly in debug mode, but in release mode the data sent over the port is missing parts (ie. instead of 0100 0100 100 , 010010 100 might get sent). I am sending the data as an array of characters, could it be the arrays are getting corrupted in release mode?

10/30/2005 7:34:40 PM

rjrgrl
All American
27061 Posts
user info
edit post

what language are you coding in?

i never had a problem with my visual basic.net code in debug vs release mode

10/30/2005 8:38:15 PM

r45t4-m4n
All American
629 Posts
user info
edit post

it's in C++

10/30/2005 11:22:47 PM

 Message Boards » Tech Talk » Visual Studio .Net question. Page [1]  
go to top | |
Admin Options : move topic | lock topic

© 2024 by The Wolf Web - All Rights Reserved.
The material located at this site is not endorsed, sponsored or provided by or on behalf of North Carolina State University.
Powered by CrazyWeb v2.39 - our disclaimer.