[Vala] Pre Increment



Vala make a wrong translation to C of:

public class PreInc {
    public static int main(string[] args)
    {
        int i=0;
        int m = 5;
        do {
            stdout.printf("%d\n",i);
        }while(++i < m);
    }
}

for the while the C generated code is :

 do {
                fprintf (stdout, "%d\n", i);
        } while (i = i + 1 < m);

in this case the program finished by a Segmentation Fault. Whereas in "while( ++i < m);" the program works

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]