From fde0fae9b1dd3cc74395d719138230ec79bd5908 Mon Sep 17 00:00:00 2001 From: binrapt Date: Sat, 10 Oct 2009 04:23:23 +0200 Subject: [PATCH] Fixed the variable code, replacing it with simpler arguments and using exceptions instead of boolean return values for the outer interface --- fridh/variable.hpp | 82 +++++------ variable/binary_operator.cpp | 82 ++++------- variable/comparison.cpp | 116 ++++++--------- variable/error.cpp | 29 ++-- variable/logical_operator.cpp | 48 +++---- variable/operator.cpp | 322 ++++++++++++++++++------------------------ variable/type.cpp | 4 +- variable/variable.cpp | 49 ++----- 8 files changed, 295 insertions(+), 437 deletions(-) rewrite variable/binary_operator.cpp (91%) rewrite variable/comparison.cpp (86%) rewrite variable/error.cpp (86%) rewrite variable/logical_operator.cpp (83%) rewrite variable/operator.cpp (60%) diff --git a/fridh/variable.hpp b/fridh/variable.hpp index e9fe01e..304f8e8 100644 --- a/fridh/variable.hpp +++ b/fridh/variable.hpp @@ -2,6 +2,7 @@ #include #include #include +#include namespace fridh { @@ -29,23 +30,6 @@ namespace fridh typedef variable_type_identifier::variable_type variable_type; - struct unary_argument - { - variable & output; - std::string & error_message; - - unary_argument(variable & output, std::string & error_message); - }; - - struct binary_argument - { - variable const & other; - variable & output; - std::string & error_message; - - binary_argument(variable const & other, variable & output, std::string & error_message); - }; - class variable; namespace types @@ -78,34 +62,40 @@ namespace fridh void new_array(); void new_map(); - bool addition(binary_argument & argument) const; - bool subtraction(binary_argument & argument) const; - bool multiplication(binary_argument & argument) const; - bool division(binary_argument & argument) const; - bool modulo(binary_argument & argument) const; +#define DECLARE_UNARY_OPERATOR(name) void name(variable & output) const; +#define DECLARE_BINARY_OPERATOR(name) void name(variable const & argument, variable & output) const; + + DECLARE_BINARY_OPERATOR(addition) + DECLARE_BINARY_OPERATOR(subtraction) + DECLARE_BINARY_OPERATOR(multiplication) + DECLARE_BINARY_OPERATOR(division) + DECLARE_BINARY_OPERATOR(modulo) - bool negative(unary_argument & argument) const; + DECLARE_BINARY_OPERATOR(negation) - bool less_than(binary_argument & argument) const; - bool less_than_or_equal(binary_argument & argument) const; - bool greater_than(binary_argument & argument) const; - bool greater_than_or_equal(binary_argument & argument) const; - bool unequal(binary_argument & argument) const; - bool equal(binary_argument & argument) const; + DECLARE_BINARY_OPERATOR(less_than) + DECLARE_BINARY_OPERATOR(less_than_or_equal) + DECLARE_BINARY_OPERATOR(greater_than) + DECLARE_BINARY_OPERATOR(greater_than_or_equal) + DECLARE_BINARY_OPERATOR(unequal) + DECLARE_BINARY_OPERATOR(equal) - bool logical_not(unary_argument & argument) const; + DECLARE_UNARY_OPERATOR(logical_not) - bool logical_and(binary_argument & argument) const; - bool logical_or(binary_argument & argument) const; + DECLARE_BINARY_OPERATOR(logical_and) + DECLARE_BINARY_OPERATOR(logical_or) - bool shift_left(binary_argument & argument) const; - bool shift_right(binary_argument & argument) const; + DECLARE_BINARY_OPERATOR(shift_left) + DECLARE_BINARY_OPERATOR(shift_right) - bool binary_and(binary_argument & argument) const; - bool binary_or(binary_argument & argument) const; - bool binary_xor(binary_argument & argument) const; + DECLARE_BINARY_OPERATOR(binary_and) + DECLARE_BINARY_OPERATOR(binary_or) + DECLARE_BINARY_OPERATOR(binary_xor) - bool binary_not(unary_argument & argument) const; + DECLARE_UNARY_OPERATOR(binary_not) + +#undef DECLARE_UNARY_OPERATOR +#undef DECLARE_BINARY_OPERATOR bool operator==(variable const & other) const; bool operator!=(variable const & other) const; @@ -127,18 +117,17 @@ namespace fridh variable_type type; - bool is_floating_point_operation(binary_argument & argument) const; + bool is_floating_point_operation(variable & argument) const; bool is_integer_type() const; bool is_numeric_type() const; bool is_zero() const; types::floating_point_value get_floating_point_value() const; - bool get_string_representation(std::string & output) const; - bool get_boolean_value(bool & output) const; + std::string get_string_representation() const; + bool get_boolean_value() const; - bool array_addition(binary_argument & argument) const; - bool perform_string_conversion(std::string & output, bool & error) const; - bool string_addition(binary_argument & argument, bool & error) const; + bool variable::array_addition(variable const & argument) const + bool string_addition(variable const & argument, variable & output) const; bool array_equality(variable const & other) const; bool map_equality(variable const & other) const; @@ -149,6 +138,7 @@ namespace fridh }; std::string get_type_string(variable_type type); - std::string get_unary_argument_type_error(std::string const & operation, variable_type type); - std::string get_binary_argument_type_error(std::string const & operation, variable_type left, variable_type right); + + void unary_argument_type_error(std::string const & operation, variable_type type); + void binary_argument_type_error(std::string const & operation, variable_type left, variable_type right); } diff --git a/variable/binary_operator.cpp b/variable/binary_operator.cpp dissimilarity index 91% index 186ae0a..76c18d5 100644 --- a/variable/binary_operator.cpp +++ b/variable/binary_operator.cpp @@ -1,55 +1,27 @@ -#include - -namespace fridh -{ -#define BINARY_OPERATOR(name, operator) \ - if(is_integer_type() && argument.other.is_integer_type()) \ - { \ - argument.output.new_unsigned_integer(unsigned_integer operator argument.other.unsigned_integer); \ - return true; \ - } \ - else \ - { \ - argument.error_message = get_binary_argument_type_error(name, type, argument.other.type); \ - return false; \ - } - - bool variable::shift_left(binary_argument & argument) const - { - BINARY_OPERATOR("Shift left", <<) - } - - bool variable::shift_right(binary_argument & argument) const - { - BINARY_OPERATOR("Shift right", >>) - } - - bool variable::binary_and(binary_argument & argument) const - { - BINARY_OPERATOR("Binary and", &) - } - - bool variable::binary_or(binary_argument & argument) const - { - BINARY_OPERATOR("Binary or", |) - } - - bool variable::binary_xor(binary_argument & argument) const - { - BINARY_OPERATOR("Binary exclusive or", ^) - } - - bool variable::binary_not(unary_argument & argument) const - { - if(is_integer_type()) - { - argument.output.new_unsigned_integer(~unsigned_integer); - return true; - } - else - { - argument.error_message = get_unary_argument_type_error("Binary not", type); - return false; - } - } -} +#include + +namespace fridh +{ +#define BINARY_OPERATOR(name, description, operator) \ + void variable::name(variable const & argument, variable & output) const \ + { \ + if(is_integer_type() && argument.is_integer_type()) \ + output.new_unsigned_integer(unsigned_integer operator argument.unsigned_integer); \ + else \ + binary_argument_type_error(description, type, argument.type); \ + } + + BINARY_OPERATOR(shift_left, "Shift left", <<) + BINARY_OPERATOR(shift_right, "Shift right", >>) + BINARY_OPERATOR(binary_and, "Binary and", &) + BINARY_OPERATOR(binary_or, "Binary or", |) + BINARY_OPERATOR(binary_xor, "Binary exclusive or", ^) + + void variable::binary_not(variable & output) const + { + if(is_integer_type()) + output.new_unsigned_integer(~unsigned_integer); + else + unary_argument_type_error("Binary not", type); + } +} diff --git a/variable/comparison.cpp b/variable/comparison.cpp dissimilarity index 86% index 1fb002d..a27d841 100644 --- a/variable/comparison.cpp +++ b/variable/comparison.cpp @@ -1,72 +1,44 @@ -#include - -namespace fridh -{ -#define NUMERIC_COMPARISON(operator) \ - if(is_numeric_type() && argument.other.is_numeric_type()) \ - { \ - if(is_floating_point_operation(argument)) \ - argument.output.new_boolean(get_floating_point_value() operator argument.other.get_floating_point_value()); \ - else if(type == variable_type_identifier::unsigned_integer && argument.other.type == variable_type_identifier::signed_integer) \ - argument.output.new_boolean(unsigned_integer operator argument.other.unsigned_integer); \ - else \ - argument.output.new_boolean(signed_integer operator argument.other.signed_integer); \ - } \ - else \ - { \ - argument.error_message = get_binary_argument_type_error(name_of_operation, type, argument.other.type); \ - return false; \ - } \ - return true; - - bool variable::less_than(binary_argument & argument) const - { - std::string const name_of_operation = "Less than"; - NUMERIC_COMPARISON(<=) - } - - bool variable::less_than_or_equal(binary_argument & argument) const - { - std::string const name_of_operation = "Less than or equal"; - NUMERIC_COMPARISON(<=) - } - - bool variable::greater_than(binary_argument & argument) const - { - std::string const name_of_operation = "Greater than"; - NUMERIC_COMPARISON(<=) - } - - bool variable::greater_than_or_equal(binary_argument & argument) const - { - std::string const name_of_operation = "Greater than or equal"; - NUMERIC_COMPARISON(<=) - } - - bool variable::unequal(binary_argument & argument) const - { - argument.output.new_boolean(operator!=(argument.other)); - return true; - } - - bool variable::equal(binary_argument & argument) const - { - argument.output.new_boolean(operator==(argument.other)); - return true; - } - - bool variable::logical_not(unary_argument & argument) const - { - bool value; - if(get_boolean_value(value)) - { - argument.output.new_boolean(!value); - return true; - } - else - { - argument.error_message = get_unary_argument_type_error("Logical not", type); - return false; - } - } -} +#include + +namespace fridh +{ +#define NUMERIC_COMPARISON(name, description, operator) \ + void variable::name(variable const & argument, variable & output) \ + { \ + if(is_numeric_type() && argument.is_numeric_type()) \ + { \ + if(is_floating_point_operation(argument)) \ + output.new_boolean(get_floating_point_value() operator argument.get_floating_point_value()); \ + else if(type == variable_type_identifier::unsigned_integer && argument.type == variable_type_identifier::signed_integer) \ + output.new_boolean(unsigned_integer operator argument.unsigned_integer); \ + else \ + output.new_boolean(signed_integer operator argument.signed_integer); \ + } \ + else \ + binary_argument_type_error(name_of_operation, type, argument.other.type); \ + } + + NUMERIC_COMPARISON(less_than, "Less than", <) + NUMERIC_COMPARISON(less_than_or_equal, "Less than", <=) + NUMERIC_COMPARISON(greater_than, "Less than", >) + NUMERIC_COMPARISON(greater_than_or_equal, "Less than", >=) + + void variable::unequal(variable const & argument, variable & output) const + { + output.new_boolean(operator!=(argument.other)); + } + + void variable::equal(variable const & argument, variable & output) const + { + output.new_boolean(operator==(argument.other)); + } + + void variable::logical_not(variable & output) const + { + bool value; + if(get_boolean_value(value)) + output.new_boolean(!value); + else + unary_argument_type_error("Logical not", type); + } +} diff --git a/variable/error.cpp b/variable/error.cpp dissimilarity index 86% index 060c50d..8a46a2f 100644 --- a/variable/error.cpp +++ b/variable/error.cpp @@ -1,14 +1,15 @@ -#include - -namespace fridh -{ - std::string get_unary_argument_type_error(std::string const & operation, variable_type type) - { - return operation + ": Invalid argument type \"" + get_type_string(type) + "\""; - } - - std::string get_binary_argument_type_error(std::string const & operation, variable_type left, variable_type right) - { - return operation + ": Invalid argument types \"" + get_type_string(left) + "\", \"" + get_type_string(right); - } -} +#include +#include + +namespace fridh +{ + void unary_argument_type_error(std::string const & operation, variable_type type) + { + throw ail::exception(operation + ": Invalid argument type \"" + get_type_string(type) + "\""); + } + + void binary_argument_type_error(std::string const & operation, variable_type left, variable_type right) + { + throw ail::exception(operation + ": Invalid argument types \"" + get_type_string(left) + "\", \"" + get_type_string(right)); + } +} diff --git a/variable/logical_operator.cpp b/variable/logical_operator.cpp dissimilarity index 83% index 2cb51c3..2a4eecc 100644 --- a/variable/logical_operator.cpp +++ b/variable/logical_operator.cpp @@ -1,29 +1,19 @@ -#include - -namespace fridh -{ -#define LOGICAL_OPERATOR(name, operator) \ - bool \ - left_value, \ - right_value; \ - if(get_boolean_value(left_value) && argument.other.get_boolean_value(right_value)) \ - { \ - argument.output.new_boolean(left_value operator right_value); \ - return true; \ - } \ - else \ - { \ - argument.error_message = get_unary_argument_type_error(name, type); \ - return false; \ - } - - bool variable::logical_and(binary_argument & argument) const - { - LOGICAL_OPERATOR("Logical and", &&) - } - - bool variable::logical_or(binary_argument & argument) const - { - LOGICAL_OPERATOR("Logical or", ||) - } -} +#include + +namespace fridh +{ +#define LOGICAL_OPERATOR(name, description, operator) \ + void variable::name(variable const & argument, variable & output) \ + { \ + bool \ + left_value, \ + right_value; \ + if(get_boolean_value(left_value) && argument.get_boolean_value(right_value)) \ + output.new_boolean(left_value operator right_value); \ + else \ + unary_argument_type_error(description, type); \ + } + + LOGICAL_OPERATOR(logical_and, "Logical and", &&) + LOGICAL_OPERATOR(logical_or, "Logical or", ||) +} diff --git a/variable/operator.cpp b/variable/operator.cpp dissimilarity index 60% index 9002196..473dfee 100644 --- a/variable/operator.cpp +++ b/variable/operator.cpp @@ -1,183 +1,139 @@ -#include - -namespace fridh -{ - bool variable::array_addition(binary_argument & argument) const - { - bool left_is_array = type == variable_type_identifier::array; - bool right_is_array = argument.other.type == variable_type_identifier::array; - - if(left_is_array || right_is_array) - { - argument.output.type = variable_type_identifier::array; - argument.output.array = new types::vector; - types::vector & vector = *argument.output.array; - - if(left_is_array && right_is_array) - { - vector = *array; - types::vector & right_vector = *argument.other.array; - vector.insert(vector.end(), right_vector.begin(), right_vector.end()); - } - else if(left_is_array && !right_is_array) - { - vector = *array; - vector.push_back(argument.other); - } - else if(!left_is_array && right_is_array) - { - vector = *argument.other.array; - vector.push_back(*this); - } - } - else - return false; - - return true; - } - - bool variable::perform_string_conversion(std::string & output, bool & error) const - { - if(!get_string_representation(output)) - { - error = true; - return false; - } - else - return true; - } - - bool variable::string_addition(binary_argument & argument, bool & error) const - { - bool left_is_string = type == variable_type_identifier::string; - bool right_is_string = argument.other.type == variable_type_identifier::string; - - error = false; - - if(left_is_string || right_is_string) - { - argument.output.type = variable_type_identifier::string; - argument.output.string = new std::string; - std::string & output_string = *argument.output.string; - if(left_is_string && right_is_string) - output_string = *string + *argument.other.string; - else if(left_is_string && !right_is_string) - return argument.other.perform_string_conversion(output_string, error); - else if(!left_is_string && right_is_string) - return perform_string_conversion(output_string, error); - } - else - return false; - - return true; - } - -#define ARITHMETIC_OPERATION(operator) \ - if(is_numeric_type() && argument.other.is_numeric_type()) \ - { \ - if(is_floating_point_operation(argument)) \ - argument.output.new_floating_point_value(get_floating_point_value() operator argument.other.get_floating_point_value()); \ - else if(type == variable_type_identifier::unsigned_integer && argument.other.type == variable_type_identifier::unsigned_integer) \ - argument.output.new_unsigned_integer(unsigned_integer operator argument.other.unsigned_integer); \ - else \ - argument.output.new_signed_integer(signed_integer operator argument.other.signed_integer); \ - } \ - else \ - { \ - argument.error_message = get_binary_argument_type_error(name_of_operation, type, argument.other.type); \ - return false; \ - } \ - return true; - - bool variable::addition(binary_argument & argument) const - { - std::string const name_of_operation = "Addition"; - - if(array_addition(argument)) - return true; - - bool string_error; - if(string_addition(argument, string_error)) - return true; - - if(string_error) - { - argument.error_message = get_binary_argument_type_error(name_of_operation, type, argument.other.type); - return false; - } - - ARITHMETIC_OPERATION(+) - } - - bool variable::subtraction(binary_argument & argument) const - { - std::string const name_of_operation = "Subtraction"; - ARITHMETIC_OPERATION(-) - } - - bool variable::multiplication(binary_argument & argument) const - { - std::string const name_of_operation = "Multiplication"; - ARITHMETIC_OPERATION(*) - } - - bool variable::division(binary_argument & argument) const - { - std::string const name_of_operation = "Division"; - if(argument.other.is_zero()) - { - argument.error_message = zero_division_error_message; - return false; - } - ARITHMETIC_OPERATION(/) - } - - bool variable::modulo(binary_argument & argument) const - { - std::string const name_of_operation = "Modulo"; - if(argument.other.is_zero()) - { - argument.error_message = zero_division_error_message; - return false; - } - else if(is_integer_type() && argument.other.is_integer_type()) - { - if(type == variable_type_identifier::unsigned_integer && argument.other.type == variable_type_identifier::unsigned_integer) - argument.output.new_unsigned_integer(unsigned_integer % argument.other.unsigned_integer); - else - argument.output.new_signed_integer(signed_integer % argument.other.signed_integer); - } - else - { - argument.error_message = get_binary_argument_type_error(name_of_operation, type, argument.other.type); - return false; - } - return true; - } - - bool variable::negative(unary_argument & argument) const - { - argument.output.type = type; - switch(type) - { - case variable_type_identifier::signed_integer: - argument.output.signed_integer = - signed_integer; - break; - - case variable_type_identifier::unsigned_integer: - argument.output.type = variable_type_identifier::signed_integer; - argument.output.signed_integer = - static_cast(unsigned_integer); - break; - - case variable_type_identifier::floating_point_value: - argument.output.floating_point_value = - floating_point_value; - break; - - default: - argument.error_message = "Cannot use unary minus on type " + get_type_string(type); - return false; - } - - return true; - } -} +#include + +namespace fridh +{ + bool variable::array_addition(variable const & argument, variable & output) const + { + bool left_is_array = type == variable_type_identifier::array; + bool right_is_array = argument.other.type == variable_type_identifier::array; + + if(left_is_array || right_is_array) + { + argument.output.type = variable_type_identifier::array; + argument.output.array = new types::vector; + types::vector & vector = *argument.output.array; + + if(left_is_array && right_is_array) + { + vector = *array; + types::vector & right_vector = *argument.other.array; + vector.insert(vector.end(), right_vector.begin(), right_vector.end()); + } + else if(left_is_array && !right_is_array) + { + vector = *array; + vector.push_back(argument.other); + } + else if(!left_is_array && right_is_array) + { + vector = *argument.other.array; + vector.push_back(*this); + } + + return true; + } + else + return false; + } + + bool variable::string_addition(variable const & argument, variable & output) const + { + bool left_is_string = type == variable_type_identifier::string; + bool right_is_string = argument.other.type == variable_type_identifier::string; + + if(left_is_string || right_is_string) + { + output.type = variable_type_identifier::string; + output.string = new std::string; + *output.string = get_string_representation() + argument.get_string_representation(); + return true; + } + else + return false; + } + +#define ARITHMETIC_OPERATION(operator) \ + if(is_numeric_type() && argument.is_numeric_type()) \ + { \ + if(is_floating_point_operation(argument)) \ + output.new_floating_point_value(get_floating_point_value() operator argument.get_floating_point_value()); \ + else if(type == variable_type_identifier::unsigned_integer && argument.type == variable_type_identifier::unsigned_integer) \ + output.new_unsigned_integer(unsigned_integer operator argument.unsigned_integer); \ + else \ + output.new_signed_integer(signed_integer operator argument.signed_integer); \ + } \ + else \ + binary_argument_type_error(name_of_operation, type, argument.type); + + void variable::addition(variable const & argument, variable & output) const + { + std::string const name_of_operation = "Addition"; + + if(array_addition(argument, output)) + return; + + if(string_addition(argument, output)) + return; + + ARITHMETIC_OPERATION(+) + } + + void variable::subtraction(variable const & argument, variable & output) const + { + std::string const name_of_operation = "Subtraction"; + ARITHMETIC_OPERATION(-) + } + + void variable::multiplication(variable const & argument, variable & output) const + { + std::string const name_of_operation = "Multiplication"; + ARITHMETIC_OPERATION(*) + } + + void variable::addition(variable const & argument, variable & output) const + { + std::string const name_of_operation = "Division"; + if(argument.other.is_zero()) + throw ail::exception(zero_division_error_message); + ARITHMETIC_OPERATION(/) + } + + void variable::addition(variable const & argument, variable & output) const + { + std::string const name_of_operation = "Modulo"; + if(argument.is_zero()) + throw ail::exception(zero_division_error_message); + else if(is_integer_type() && argument.is_integer_type()) + { + if(type == variable_type_identifier::unsigned_integer && argument.type == variable_type_identifier::unsigned_integer) + output.new_unsigned_integer(unsigned_integer % argument.unsigned_integer); + else + output.new_signed_integer(signed_integer % argument.signed_integer); + } + else + binary_argument_type_error(name_of_operation, type, argument.type); + } + + void variable::negation(variable & output) const + { + output.type = type; + switch(type) + { + case variable_type_identifier::signed_integer: + output.signed_integer = - signed_integer; + break; + + case variable_type_identifier::unsigned_integer: + output.type = variable_type_identifier::signed_integer; + output.signed_integer = - static_cast(unsigned_integer); + break; + + case variable_type_identifier::floating_point_value: + output.floating_point_value = - floating_point_value; + break; + + default: + throw ail::exception("Cannot use unary minus on type " + get_type_string(type)); + } + } +} diff --git a/variable/type.cpp b/variable/type.cpp index 22f882a..2501ac1 100644 --- a/variable/type.cpp +++ b/variable/type.cpp @@ -7,9 +7,9 @@ namespace fridh return type; } - bool variable::is_floating_point_operation(binary_argument & argument) const + bool variable::is_floating_point_operation(variable & argument) const { - return type == variable_type_identifier::floating_point_value || argument.other.type == variable_type_identifier::floating_point_value; + return type == variable_type_identifier::floating_point_value || argument.type == variable_type_identifier::floating_point_value; } bool variable::is_integer_type() const diff --git a/variable/variable.cpp b/variable/variable.cpp index 3554391..f3e6740 100644 --- a/variable/variable.cpp +++ b/variable/variable.cpp @@ -8,19 +8,6 @@ namespace fridh std::string const zero_division_error_message = "Zero division error"; } - unary_argument::unary_argument(variable & output, std::string & error_message): - output(output), - error_message(error_message) - { - } - - binary_argument::binary_argument(variable const & other, variable & output, std::string & error_message): - other(other), - output(output), - error_message(error_message) - { - } - variable::variable(): type(variable_type_identifier::undefined) { @@ -96,54 +83,44 @@ namespace fridh throw ail::exception("Failed to retrieve floating point value"); } - bool variable::get_string_representation(std::string & output) const + std::string variable::get_string_representation() const { switch(type) { case variable_type_identifier::boolean: - output = ail::bool_to_string(boolean); - break; + return ail::bool_to_string(boolean); case variable_type_identifier::signed_integer: - output = ail::number_to_string(signed_integer); - break; + return ail::number_to_string(signed_integer); case variable_type_identifier::unsigned_integer: - output = ail::number_to_string(unsigned_integer); - break; + return ail::number_to_string(unsigned_integer); case variable_type_identifier::floating_point_value: - output = ail::number_to_string(floating_point_value); - break; + return ail::number_to_string(floating_point_value); - default: - return false; + case variable_type_identifier::string: + return *string; } - return true; + get_unary_argument_type_error("String representation", type); } - bool variable::get_boolean_value(bool & output) const + bool variable::get_boolean_value() const { switch(type) { case variable_type_identifier::boolean: - output = boolean; - break; + return boolean; case variable_type_identifier::signed_integer: - output = signed_integer != 0; - break; + return signed_integer != 0; case variable_type_identifier::unsigned_integer: - output = unsigned_integer != 0; - break; - - default: - return false; + return unsigned_integer != 0; } - return true; + get_unary_argument_type_error("Boolean representation", type); } bool variable::is_zero() const -- 2.11.4.GIT