I just wanted to mention that I like the idea of the debug info being output to a file but
with that I was getting nothing until I put some endl 's in there to flush it to file before the segfaults.
Now things like this show up and are very helpful:
interesting thread , thanks
fout << "12 " << "mortals->next->next= " << mortals->next->next << endl;
FWIW: endl is equivalent to printing a newline and then calling fout.flush(). So if for some reason you want to flush the output without printing a newline, well, now you know how. :)