TURBO PASCAL |
Новости
|
41: What is wrong with my program? It hangs without a clear pattern?A: With experience one learns that some programming errors are very elusive. I have many times seen users declaring that they have found a bug in Turbo Pascal, but in the overwhelming majority of cases it still is just a programming error, which just is more difficult to find than the more clear-cut cases. When you have symptoms like your program crashing from within the IDE, but working seemingly all right when called as stand-alone, or something equally strange, you might have one of the following problems. - A variable or some variables in your code are uninitialized thus getting random values, which differ depending on your environment. - Your indexes are overflowing. Set on the range check {$R+} directive for testing. - An error in the pointer logic. Normal debugging does not necessarily help in locating these errors because one is easily led to debugging the wrong parts of one's program. Especially the latter two reasons can cause errors which seemingly have nothing to do with the actual cause. This results from the fact that indexing and pointer errors can overwrite parts of memory causing strange quirks in your program. If you have used indexing with {$R-} or if you use pointer operations, sooner or later you are bound to have these problems in developing your applications. See Edward Mitchell (1993), Borland Pascal Developer's Guide, 275-288 for common programming errors and especially the information on memory clobbering, in a useful chapter on debugging Turbo Pascal programs. You might also take a look at your Turbo Pascal User's Guide. At least version 7.0 has an instructive general categorization of errors on pages 76-77. |
(с)Все права защищены По всем интересующим вопросам прошу писать на электронный адрес |