[comp.os.msdos.programmer] Stack Overflow! -- turbo c++ 1.0

pts@faraday.clas.Virginia.EDU (Paul T. Shannon) (03/06/91)

I have a turbo c++ bug that perhaps some one has seen before.  I suspect
that this is a bug in the compiler (borland's c++ version 1.0).

I've developed a small class that does ega animation by storing images in
expanded memory, and retrieving them on demand.  This code works great
when all of the source code is in one file.  All possible error checking
is on, at both compile- and run-time.   I've exercised this a lot. 
For simplicity, let's call this file class.cpp.

In preparation for using this class with a larger c++ program, I decided
to test the new class by calling it out of a very small separate main
program (call it main.cpp).  The class header is included, and maybe 40
lines of code were moved from class.cpp to main.cpp.   

Now I find that as soon as the first call is made  by main.cpp, to a member 
function in class.cpp, the program aborts with the message 

  Stack Overflow!

I've checked for errors, I've tried many different memory models, I've 
traced execution with td 2.0.  All to no avail.

If however, I turn the stack checking off (from the compiler option menu),
the program runs fine....except that I'm really nervous about what sins
might be hidden behind the curtains.

Has anyone seen a bug like this?  Any suggestions?

 - Paul Shannon
   pts@virginia.edu