Re: Divide by zero, app does NOT crash?
Posted in 1998
On Mon, 7 Dec 1998, Andrej Falout wrote: > I guess that not very often you see someone complaining about app not crashing, > but... No, that's the first time in a while I've seen that complaint... :-) > My client have an 4gl app, c-compiled, some external c functions. > > Error log is full of entries like this: > > FORMS statement error number -1202. > An attempt was made to divide by zero. > > No line number, no sourcefile name. > > I was expecting that divide by zero will unconditionally stop the app, > but, it seems that this is not the case. There are at least 50 entries > like that a day, and I am unable to trace them. Those divisions are occurring in the I4GL runtime libraries -- only those check the divisor and write a message to the log file (your C code doesn't). And those routines don't know where they are being called from, which makes it more difficult to log the errors precisely. [Yeah, yeah, I know the p-code system does know where it is and yes, it could be done with the c-code system too, but it isn't, and hasn't been, and probably won't be fixed, primarily because there are other more important things to work on.] > Is it possible that this error can be the result of the SQL statement > that is trying to divide by zero, and because it happens in the engine, > it does not kill the app? No; any computation done by the engine which caused an error would notify the app via the SQLCA record, not by mysterious messages in the log file. > And most of all, how to trace this, if the app does not crash? With difficulty...First step, ensure you are compiling with WHENEVER ANY ERROR STOP. This should help isolate the problem by stopping on the error rather than silently logging it. > BTW, no debugger there. Well, try booting the old 8088 PC over in the corner and see if that helps :-) Not having good tools is always a handicap. Yours, Jonathan Leffler (jleffler@informix.com) #include <witticism.h> Guardian of DBD::Informix v0.60 -- http://www.perl.com/CPAN Informix IDN for D4GL & Linux -- http://www.informix.com/idn