Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 84417
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T21:55:39+00:00 2026-05-10T21:55:39+00:00

What are the expert debugging hints for your favourite language, you think everyone should

  • 0

What are the expert debugging hints for your favourite language, you think everyone should use?

As an example, I’ll provide my C++ debugging hints, that between them help me shake out most of the bugs I come across, in this often hard-to-debug language.

C++

  • Increase the warning level of your compiler to maximum, then stop those warnings which occur a lot and you’ve decided you don’t care about (for me it’s unused parameters). g++ doesn’t warn about missing return statements in functions (a problem I find frequently) until the warning level is very high.

  • Learn how to turn on your compiler’s debugging standard library, and use it! ( -D_GLIBCXX_DEBUG for g++). This finds lots of errors, and also helps show exactly where the errors occurred.

  • Always, always, always run your code through a really good memory checker, like valgrind, and fix all the problems it produces.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T21:55:40+00:00Added an answer on May 10, 2026 at 9:55 pm

    A couple of my own, from spending too many nights debugging stuff that the compiler or runtime environment could have warned me about if I’d used it properly:

    • If you’re doing anything with pointers in C++, assert() them wherever suitable. In fact, assert()ing invariants is generally a good idea and can cut the debugging time on that one obscure bug from weeks to minutes. Just remember to turn them off in the release build. Oh, and don’t put anything in there that has side effects, otherwise you’ll be debugging your release build for a little while. Don’t ask me how I found out that one
    • In a similar vein, BOOST_STATIC_ASSERT can be extremely helpful in checking for discrepancies you can check at compile time
    • Memory debuggers like PurifyPlus or valgrind are excellent time-saving devices and should be on every developer’s machine
    • Learn how to use the debugger properly so you can harness its full power instead of just using it as a device that allows you to single-step through your code
    • If you’re really stuck, explain the problem and the code to a colleague
    • For C++, a tool like FlexeLint/PC-Lint can help pinpoint a lot of hard-to-find stuff once you configured it properly. You’ll have to invest the time to configure it otherwise you’ll drown in warnings
    • If you’re writing C++ and you’re using the standard containers, write code that uses iterators and let the debug version of the runtime (or a debug STL) catch your off-by-one errors. If you use indices to reference elements in, say, a std::vector<> you’ll have to find those yourself
    • Run the code through different compilers if you can and pay heed to the warnings each one of them produces. However make sure that they’re at similar levels of language compatibility (no point in running modern C++ code through MS VC++ 6) otherwise you’ll end up chasing problems that aren’t really there.

    Ideally, you should try to catch problems before you need to fire up the debugger – anything you can tweak such that it creates a compilation error is much easier to fix compared to tracking it down in the debugger and then fixing it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 106k
  • Answers 106k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I like using Custom Configuration Handlers. http://haacked.com/archive/2007/03/12/custom-configuration-sections-in-3-easy-steps.aspx May 11, 2026 at 8:59 pm
  • Editorial Team
    Editorial Team added an answer If you're just wrapping a collection you can use a… May 11, 2026 at 8:59 pm
  • Editorial Team
    Editorial Team added an answer The video card won't participate in any activity unless it… May 11, 2026 at 8:59 pm

Related Questions

I'm currently working on a quite big (and old, sigh) code base, recently upgraded
Currently my workflow with Emacs when I am coding in C or C++ involves
I'm working on a web application, and we are targeting the iPhone and iPod
I have created a debugger visualizer in VS2008. There are two classes i've made,

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.