Sep 11, 2007 11:26
So, this project I've been working on from time to time for the last couple years actually has recently been completed. The problem is, as it stands, there's no way to (officially) test it within the framework of the program for which it is designed. So, a driver program, which goes through the code, runs a bunch of test cases, and prints out the results, was written.
Note the (officially) up above. While writing this code, I'd added some code to the primary program to test it as I went along. This test code is never going to be added to the main program, and thus, can't be used as a test program. The new project works perfectly well within the framework of that test code, no issues whatsoever.
When I compile the stuff in with the driver program, and go to run it, it core dumps on me. Tracing everything back, I discover that I'm getting a Seg Fault on the *very* first call in the *very* first constructor.
As best as I can assume/determine right now, the 'new' operator is core dumping. In code that has worked perfectly well before (and still does), just not within the driver program.
What's worse (in my mind) is that I had a driver program up and running, mostly perfectly, not too long ago. I changed something and had to do a clean build...and somehow managed to delete all of the code for the driver in the process, having to redo it all. And now I have this issue that makes no sense to me whatsoever.
EDIT:
Well, that fiasco is over. In what may be the second dumbest coding mistake I've ever made, I had in a file I wasn't even considering as part of the issue the code:
char *output = new char(255);
I was then adding about 40 or so characters to the output variable. Note that it should have read as thus:
char *output = new char[255];
Note the square brackets rather than the parenthesis. Thank god for memory leak tracing programs--this would have taken me forever to find.
(The dumbest mistake I've ever made--I continually reverse not-equal and equal when trying to use strcmp...continually. At least once a week, it seems I do that and then spend about an hour trying to figure out why it's not working).