Heisenbug

Greetings. I am experiencing a bug that is very frustrating to track down.
My main way of tracking bugs is to put diagnostic output in the code. However,
in this case, even adding some cout statements causes the error to disappear.

I suspect that somewhere I am writing past array bounds or committing some other error that causes undefined behavior. To this end, I am trying to eliminate these causes. For example, instead of referencing vectors as, for example, Vec[i], I am using at, which checks array bounds: Vec.at(i).

Does anyone have any additional suggestions? As I said, I have been unable to track down this error. I would love to show you the code, but it's several thousand lines long.
debugger, its a lovely tool xD
closed account (o3hC5Di1)
Hi there,

Not sure which environment your coding in, but here's an excellent article by Moschops on debugging segfaults with GDB: http://cplusplus.com/articles/iwTbqMoL/

If you want us to help you track the error I'm afraid we'll have to see some code and a more elaborate description of the unexpected behaviour you're getting.

All the best,
NwN

Topic archived. No new replies allowed.