C++: Cake or Death?

Oddly happy. I’ve got a program where if I run it in the debugger, it completes, and if I run it in the command line it segfaults. This pleases me obscurely.

Yes, I’ve checked it’s the same source file and the same build. No, I’m probably not going to dig into it, I’m just going to fix it and move onto the next problem. However, I’m pleased that I can build something that breaks, because it’s a good step on the road to building something that doesn’t break.

ETA: Wasn’t finding file to make it when edited either. Now is. Still no segfault though.

2 thoughts on “C++: Cake or Death?”

  1. First suggestion would be to point valgrind at it. One reason that the debugger might make a difference is that stack frames and dynamic storage might be in a different place when the debugger is in play. This won’t normally be an issue, but if you have uninitialised variables somewhere it can cause a lot of trouble.

    1. In the end what I did was move away from it and destroy all evidence of having tried. However, that makes sense and … OK, it did consistently die at the same point or not, but I’m OK with that. IT MAKES SENSE THEREFORE IT IS RIGHT AND WE CAN MOVE ON.

      Lessons were learned.

      Line in the sand…

      (Thank you. That does help.)

Leave a Reply

Your email address will not be published. Required fields are marked *