diff --git a/backends/cbackend.py b/backends/cbackend.py index 6ada8ef7fbd8daba6c36aaffb7140dccbcd91350..2c2c14a7a05abffdd397d1c3e45860b75cf30d8e 100644 --- a/backends/cbackend.py +++ b/backends/cbackend.py @@ -161,8 +161,8 @@ class CBackend: def _print_SympyAssignment(self, node): if node.is_declaration: data_type = "const " + str(node.lhs.dtype) + " " if node.is_const else str(node.lhs.dtype) + " " - return "%s %s = %s;" % (data_type, self.sympy_printer.doprint(node.lhs), - self.sympy_printer.doprint(node.rhs)) + return "%s%s = %s;" % (data_type, self.sympy_printer.doprint(node.lhs), + self.sympy_printer.doprint(node.rhs)) else: lhs_type = get_type_of_expression(node.lhs) if type(lhs_type) is VectorType and node.lhs.func == cast_func: diff --git a/data_types.py b/data_types.py index 87c5b96781af13045817a8eca2c8422503ca5def..383d603b6fe789b6c00ccaec09f9c77549a1e79b 100644 --- a/data_types.py +++ b/data_types.py @@ -461,7 +461,12 @@ class PointerType(Type): return (self.base_type, self.const, self.restrict) == (other.base_type, other.const, other.restrict) def __str__(self): - return "%s *%s%s" % (self.base_type, " RESTRICT " if self.restrict else "", " const " if self.const else "") + components = [str(self.base_type), '*'] + if self.restrict: + components.append('RESTRICT') + if self.const: + components.append("const") + return " ".join(components) def __repr__(self): return str(self)