#: 3958 S3/Languages
29-May-90 20:46:30
Sb: #3938-C error trapping
Fm: James Jones 76257,562
To: Dan Charrois 70721,1506 (X)
OK--there are errors and there are errors. For instance--if you're on a 68020
and using a 68881, an attempt to divide by zero will blow you off with an
exception from the coprocessor. Other errors are caught by defensive coding in
library routines and result in setting errno and returning some special value
(e.g. EOF from getc()). Software floating-point behavior depends on how the
stuff is written, of course.
For division by zero, I fear that the best way to catch the problem is to test
the divisor before you divide. (Alas, that won't catch overflow.) Different
routines handle errors differently, is about all I can say--read the docs
carefully.
|