Invalid operands of the binary operation
Minimal example:
void sas (int[] array, string[] lines){
for (int i = 0; i < array.length-1; i++){
if (array[i] > array[i+1]) lines[i] += "{";
else lines[i] += "}";
}
}
void main(){
int[] arr = {1,0,2};
string[] lines = {"a","b","c"};
sas(arr, lines);
}
Error:
test.vala.YGN9C0.c:52:15: error: invalid operands of the binary operation + («gchar *» {aka «char *»} и «gchar *» {aka «char *»})
52 | lines[i] += _tmp4_;
| ^~
In C code:
_tmp2_ = array[i];
_tmp3_ = array[i + 1];
if (_tmp2_ > _tmp3_) {
gchar* _tmp4_;
_tmp4_ = g_strdup ("{");
_g_free0 (lines[i]);
lines[i] += _tmp4_;
} else {
gchar* _tmp5_;
_tmp5_ = g_strdup ("}");
_g_free0 (lines[i]);
lines[i] += _tmp5_;
}
Vala 0.46.5
Edited by Rico Tzschichholz