tech-userlevel archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: standards on SIGFPE for divide by zero
On Mar 3, 2011, at 2:12 18AM, Ignatios Souvatzis wrote:
> On Wed, Mar 02, 2011 at 02:59:32PM -0500, Thor Lancelot Simon wrote:
>
>> You want the program to get a floating-point-exception signal on a bad
>> integer divide?
>
> Uh, it's been a generic arithmetic error signal for a long time, like
> ENOTTY complaining about generic wrong-type-of-file-descriptor situations.
> I was surprised by that a couple of years ago.
>
> SUSV3 defines:
>
> SIGFPE A Erroneous arithmetic operation.
> ...
> SIGFPE FPE_INTDIV Integer divide by zero.
> FPE_INTOVF Integer overflow.
> FPE_FLTDIV Floating-point divide by zero.
> (...)
>
> Now, if the hardware in question can't create SIGFPE on integer divide,
> I don't think we should torture the compiler into simulating it.
>
What does the C standard say? Is the exception required?
--Steve Bellovin, http://www.cs.columbia.edu/~smb
Home |
Main Index |
Thread Index |
Old Index