[PURRS-devel] Exceptions.

Tatiana Zolo zolo at cs.unipr.it
Thu Oct 3 12:33:04 CEST 2002


Hi.

I have problems in understanding GiNaC policy regarding the choice of
exceptions thrown.

The operator `operator/' defined on objects of the class `numeric'
throws a `runtime_error' in the case of a division by zero. In contrast,
the `operator/' defined on objects of the class `ex' throws a
`logic_error' in the case of a division by zero.

Why is there such a difference?

According to the standard, the exception `logic_error' should be used
when errors could have been detected before program execution: I thus
believe that a `runtime_error' should be thrown even in the case of an
`ex' object.

The same argument hold for the exception thrown by `power':
            logic_error: power::eval(): division by zero.

Thanks
    Tatiana Zolo




More information about the PURRS-devel mailing list