3 ms·
Well, I know that I ran into a situation (and may once have posted about it) in a C program where I was doing printf to debug a program, and it ran fine. Whenev
by EwanG 11y ago
Well, I know that I ran into a situation (and may once have posted about it) in a C program where I was doing printf to debug a program, and it ran fine. Whenever I removed them, the program would crash. Finally discovered that the printf debugging was forcing garbage collection which took care of a bad pointer somewhere else in the program. Honestly can't remember if I ever found the pointer or just left the printfs in the code...
- nitrogen 11y agoThank goodness we have Valgrind these days. Though I don't know how well it would handle a C app with a garbage collector. Calling printf can (will) change what's beyond the stack of the calling function, so if the pointer in question pointed outside the active stack, printf may have put a safer value there by coincidence.