lab2 feat: prevent division by zero in non-folded operations
This commit is contained in:
@@ -334,6 +334,13 @@ static int write_operation(
|
||||
}
|
||||
else
|
||||
{
|
||||
#endif
|
||||
#if LAB2_PREVENT_NON_FOLDED_DIV_BY_ZERO == 1
|
||||
if (r.t == Expression::Token::CONST && r.v.d == 0.0 && o.v.o == Expression::Token::DIV)
|
||||
{
|
||||
pr_warn("Right operand is zero, operation will raise exception during runtime");
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
int this_op_weight = get_operator_weight(mv, location) + 1;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user