Differences in Debug and Release builds in MSVC

This is a discussion on Differences in Debug and Release builds in MSVC within the C Programming forums, part of the General Programming Boards category; Does anybody know what the differences are? For some reason, my program will run just fine when built as debug, ...

  1. #1
    Registered User TravisS's Avatar
    Join Date
    Jun 2002
    Posts
    536

    Differences in Debug and Release builds in MSVC

    Does anybody know what the differences are? For some reason, my program will run just fine when built as debug, but when built as Release, it's messed up.

    There is no difference between the code, or anything else. All I'm doing is changing from debug to release. Is there something I'm missing?

  2. #2
    Registered User Azuth's Avatar
    Join Date
    Feb 2002
    Posts
    236
    Doesn't debug include things defined under an ifdef as debug information? Do you have any of those in your code.
    Demonographic rhinology is not the only possible outcome, but why take the chance

  3. #3
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    It's possible it has to do with your code, or more specificly, where it's looking for it's data.

    For example:

    \my project\project name\debug\
    \my project\project name\release\

    Two different paths. You provide a data file, which is just opened with the following command, to the 'debug' directory:

    fp = fopen( "mydatafile.dat", "r" );

    Then you try and read from it without doing any error checking. Your file, which is not present in the '\release\' directory, prevents the program from running correctly, because it isn't looking in the correct location for the data.

    Yes, I have seen this (I've done it).
    No, this may not be the cause, but it is a possible cause.


    Quzah.
    Hope is the first step on the road to disappointment.

  4. #4
    Registered User TravisS's Avatar
    Join Date
    Jun 2002
    Posts
    536
    Sorry, I really should have included more info. I will include my code, but I don't think it will help too much.

    Here's what happens:

    Working with debug. This is my mIRC log scanning program that creates statistics. Of course, in mIRC people have nicknames, and those nicknames often change. I have a file that contains a list of nick names that the user can edit, add nicks, delete nicks, etc...
    Every line of the nick file is a new nickname group.
    The first thing my program does when you select the log to analyze is it creates a parsed version of the original file, part of which is grouping nicknames. It pulls all of the nicks out of the nickgroup file and puts it into memory. The log is then scanned, and everytime it comes across the nickname to group, it changes it and writes this new nickname and line to the temporary file.
    This all works perfectly in debug...

    Working with release. EVERY nickname in the log file is changed to whatever the last nick is in the nickgroup file. It is properly openening up each file. If it didn't, the program would give an error and exit. Plus, the fact that it's changing every nick to what's in the nickgroup file shows it's working.
    But, I can't figure out why it's not doing it right, and unfortunaltely I can't run a debug on a release build

    Well, that's what is happening.


    Oh, and when I run the program, I take the .exe out of either the debug or the release folder and put it in the main directory, so the .exe is always in the correct locations to load the other files.
    Attached Files Attached Files

  5. #5
    Registered User TravisS's Avatar
    Join Date
    Jun 2002
    Posts
    536


    I really don't know what's going on, anybody have a clue?

    If I can't get this to work, I'll have to go back to my old crappier version of nickname grouping....


    Oh, and I also noticed that it's not just changing everyname to the last one in the file, it's changing every name in the log to every name in the nickgrouping file. Of course they all end up the last one because it goes through every nick in the file.

  6. #6
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,856
    In debug mode more / some space is allocated for extra debug info. Memory use and allocation is less strictly controlled. If you go 'out of bounds' in an array in debug, it may just overwrite this extra debug info's memory and not crash/ cause an error in your app. In release there is no extra space and the OOB array causes a crash / error.

    Try adding a series of Messageboxes / log file writes to the code to report values and moving them until the error occurs and you can isolate the cause.

    Also check your linking, debug and release libraries.
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. debug release conf problem
    By fighter92 in forum Game Programming
    Replies: 6
    Last Post: 03-20-2009, 04:39 PM
  2. makefiles - debug & release?
    By cpjust in forum C Programming
    Replies: 6
    Last Post: 10-26-2007, 04:00 PM
  3. Results in Debug and Release mode are different
    By jaro in forum C Programming
    Replies: 11
    Last Post: 05-27-2006, 11:08 AM
  4. Release vs. Debug mode builds
    By earth_angel in forum C++ Programming
    Replies: 5
    Last Post: 11-10-2005, 03:41 PM
  5. Release and Debug builds dont work
    By garethmaguire in forum C# Programming
    Replies: 3
    Last Post: 04-10-2003, 01:58 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21