Thread: displaying debug information

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #11
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Quote Originally Posted by Bladactania
    I was operating under the assumption that the debug code would be removed once development is complete, which would mean the resources used by the extra if statements would be only during development.
    Yes, it is true that an optimising compiler is likely to just remove those if statements so there would be zero overhead.

    EDIT:
    I just remembered: the standard assert macro depends on whether NDEBUG is defined, and it would be good to use this... but it does not fit so well into your example as it does with Snafuist's example, since you are relying on boolean values whereas Snafuist relies on whether a name is defined, just like how assert works.
    Last edited by laserlight; 02-17-2009 at 11:43 AM.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 10
    Last Post: 04-28-2008, 05:45 PM
  2. Debug --> Exceptions in Visual Studio 2005
    By George2 in forum C# Programming
    Replies: 1
    Last Post: 08-10-2007, 02:12 AM
  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. debug dll
    By axr0284 in forum C++ Programming
    Replies: 3
    Last Post: 03-06-2006, 04:52 PM
  5. Going out of scope
    By nickname_changed in forum C++ Programming
    Replies: 9
    Last Post: 10-12-2003, 06:27 PM