var array_type = (ArrayType) param.variable_type;
var length_ctype = get_ccode_array_length_type (param) ?? get_ccode_array_length_type (array_type);
for (int dim = 1; dim <= array_type.rank; dim++) {
- var temp_array_length = get_temp_variable (new CType (length_ctype));
+ var temp_array_length = get_temp_variable (new CType (length_ctype, "0"), true, null, true);
emit_temp_var (temp_array_length);
append_array_length (arg, get_variable_cexpression (temp_array_length.name));
carg_map.set (get_param_pos (get_ccode_array_length_pos (param) + 0.01 * dim), new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, get_array_lengths (arg).get (dim - 1)));
append_array_length (expr, len_call);
} else if (get_ccode_array_length (m)) {
var length_ctype = get_ccode_array_length_type (m) ?? get_ccode_array_length_type (array_type);
- var temp_var = get_temp_variable (new CType (length_ctype), true, null, true);
+ var temp_var = get_temp_variable (new CType (length_ctype, "0"), true, null, true);
var temp_ref = get_variable_cexpression (temp_var.name);
emit_temp_var (temp_var);
append_array_length (expr, len_call);
} else if (get_ccode_array_length (deleg)) {
- var temp_var = get_temp_variable (new CType (get_ccode_array_length_type (array_type)), true, null, true);
+ var temp_var = get_temp_variable (array_type.length_type, true, null, true);
var temp_ref = get_variable_cexpression (temp_var.name);
emit_temp_var (temp_var);
*/
public string ctype_name { get; set; }
- public CType (string ctype_name) {
+ /**
+ * The default value of the C type.
+ */
+ public string cdefault_value { get; set; }
+
+ public CType (string ctype_name, string cdefault_value) {
this.ctype_name = ctype_name;
+ this.cdefault_value = cdefault_value;
}
public override DataType copy () {
- return new CType (ctype_name);
+ return new CType (ctype_name, cdefault_value);
}
}
expr.value_type.value_owned = true;
set_cvalue (expr, to_string);
} else {
- var temp_var = get_temp_variable (new CType (is_flags ? "GFlagsValue*" : "GEnumValue*"), false, expr, false);
+ var temp_var = get_temp_variable (new CType (is_flags ? "GFlagsValue*" : "GEnumValue*", "NULL"), false, expr, false);
emit_temp_var (temp_var);
var class_ref = new CCodeFunctionCall (new CCodeIdentifier ("g_type_class_ref"));