Turbo-C Debugger Oddity

Walter Bright bright at Data-IO.COM
Thu Feb 9 04:28:25 AEST 1989


In article <210 at calmasd.Prime.COM> wlp at calmasd.Prime.COM (Walter L. Peterson, Jr.) writes:
<EVERY time I run the program from
<the DOS prompt, it fails with the same floating point error at
<( apparently ) the same place; EVERY time I run the program from the
<Turbo-C environment, it works !!
<Has anyone out there ever encountered this type of situation with the
<Turbo-C environment and if so is there a solution ?

This is the classic problem with using a debugger. Possible reasons are:
1. Using an uninitialized variable. The debugger loads the program into
   a different location in memory, resulting in a different initial value.
2. The debugger uses some memory, meaning that the storage layout of your
   program is now different. Pointer bugs will therefore have different
   effects.
3. The debugger uses some memory, which will cause a program to run out
   of free store sooner, with correspondingly different behavior.
4. The debugger may trap floating point and emulate it itself, and have
   bugs in it causing different behavior.

Solution? Debug using gedanken experiments and printf's. Run a fresh
listing and read it during lunch.



More information about the Comp.lang.c mailing list