Fixing Segmentation faults in C++

前端 未结 6 1835
被撕碎了的回忆
被撕碎了的回忆 2020-11-27 09:44

I am writing a cross-platform C++ program for Windows and Unix. On the Window side, the code will compile and execute no problem. On the Unix side, it will compile however w

6条回答
  •  时光说笑
    2020-11-27 10:41

    Sometimes the crash itself isn't the real cause of the problem-- perhaps the memory got smashed at an earlier point but it took a while for the corruption to show itself. Check out valgrind, which has lots of checks for pointer problems (including array bounds checking). It'll tell you where the problem starts, not just the line where the crash occurs.

提交回复
热议问题