Thread: Nub question on debug version

  1. #1
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,195

    Nub question on debug version

    using VC++ 6.0 I have a piece of code that I want compiled only when I build the debug version and a diffeerent section of code I want compiled only when I build the release version. anyone know what the preprocessor directives are for doing this?

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    The pre-processor symbol NDEBUG is defined when you do a release build.

    Seems dangerous to me. Debug code should only contain "extra" code - to help you debug it, not different code between debug and release.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,195
    Thanks, what Im doing is skipping the anti-debugger check in the debug code, since I want to be able to use a debugger during development, and including it in the release, since I dont want people reverse engineering my software. While Im sure its still possible to RE even with this check i just want to make it as difficult as possible.
    Last edited by abachler; 08-08-2007 at 10:41 AM.

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    It might slow down someone who is good by all of about 5 seconds.
    Just long enough for them to knobble the "isDebuggerPresent" into always returning false.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. another do while question
    By kbpsu in forum C++ Programming
    Replies: 3
    Last Post: 03-23-2009, 12:14 PM
  2. Results in Debug and Release mode are different
    By jaro in forum C Programming
    Replies: 11
    Last Post: 05-27-2006, 11:08 AM
  3. Very simple question, problem in my Code.
    By Vber in forum C Programming
    Replies: 7
    Last Post: 11-16-2002, 03:57 PM
  4. Question type program for beginners
    By Kirdra in forum C++ Programming
    Replies: 7
    Last Post: 09-15-2002, 05:10 AM
  5. Ask about Debug Assert Failed
    By ooosawaddee3 in forum C++ Programming
    Replies: 0
    Last Post: 04-24-2002, 11:07 PM