Divide by zero does not throw exception for longs

Tom Tromey tromey@redhat.com
Tue Jun 12 22:33:00 GMT 2001


>>>>> "Alexandre" == Alexandre Oliva <aoliva@redhat.com> writes:

Alexandre> Probably just because division by zero in C invokes
Alexandre> undefined behavior, so it's more efficient to optimize for
Alexandre> the well-defined behavior and leave undefined cases
Alexandre> undefined.
In theory we enable code in gcc that disables this sort of thing.
Alexandre> Java probably needs some different implementation that
Alexandre> actually checks for a zero-valued dividend and throws an
Alexandre> exception.
We do this on platforms where the runtime behavior of the divide isn't
what we want.
If necessary we can enable this on x86. It is a simple change in
libjava/configure.host. However I'd like to verify the problem for
myself first...
Tom


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /