Hacker News new | ask | show | jobs
by lordnacho 3033 days ago
Every coder at some stage has run into this, right?

- A bug that disappears when you try to add some cout<< lines.

- Everything looks correct in debug, where (as mentioned) the variables are initialised to nice values like 0. When you compile with -O3, you get really large values instead.

- A bug that is rare enough that you have to run the program for a long while before it happens. And when it does, you haven't logged the relevant information.

- A bug that only manifests when you're not trying to show a colleague.

1 comments

> Everything looks correct in debug, where (as mentioned) the variables are initialised to nice values like 0. When you compile with -O3, you get really large values instead.

Uninitialized variable. Turn on warnings.