mirror of
https://github.com/Z3Prover/z3
synced 2025-08-18 09:12:16 +00:00
Note that Z3_get_numeral_small is essentially redundant (#7599)
* Check that Z3_get_numeral_small is given non-null out params Analogous to other Z3_get_numeral_* functions with out params. * Note that Z3_get_numeral_small is essentially redundant The error behavior of Z3_get_numeral_small does not follow the pattern of the other functions. The functions that have out params and return a bool indicating success (such as Z3_get_numeral_rational_int64) return false rather than signaling an error when given an unsupported expression argument (such as a rounding mode value). The functions that do not have out params signal an error in such cases. Z3_get_numeral_small is the odd one out in that it signals errors and returns a status bool. This error handling is the only difference between Z3_get_numeral_small and Z3_get_numeral_rational_int64, so this patch adds a comment to the documentation.
This commit is contained in:
parent
63ad2837e2
commit
8d81a2dcaf
2 changed files with 6 additions and 0 deletions
|
@ -318,6 +318,10 @@ extern "C" {
|
|||
LOG_Z3_get_numeral_small(c, a, num, den);
|
||||
RESET_ERROR_CODE();
|
||||
CHECK_IS_EXPR(a, false);
|
||||
if (!num || !den) {
|
||||
SET_ERROR_CODE(Z3_INVALID_ARG, nullptr);
|
||||
return false;
|
||||
}
|
||||
rational r;
|
||||
bool ok = Z3_get_numeral_rational(c, a, r);
|
||||
if (ok) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue