Ian Lance Taylor wrote:
Robert Dewar <[EMAIL PROTECTED]> writes:


Ian Lance Taylor wrote:


We do want to generate a trap for x / 0, of course.

Really? Is this really defined to generate a trap in C?
I would be surprised if so ...


As far as I know, but I think it would be a surprising change for x /
0 to silently continue executing.

But perhaps not a very important one.

It depends on the front-end language. For C, perhaps is would not matter. For Java, the language specification requires an ArithmaticException to be thrown. In libgcj this is done by having the operation trap and the trap handler generates the exception.

Because libgcj already handles all of this, it was brought up that a similar runtime trap handler could easily be used for C. However as others have noted, the logistics of universally using a trap handler in C might be difficult.

David Daney

Reply via email to