Re: [Vala] Pre Increment




On Mon, 2007-08-20 at 14:32 +0200, Ed Schouten wrote:
* Clément DAVID <c david86 gmail com> wrote:
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

Looks like Vala forgets to put braces around the statement.
Fixed in SVN.

Raffaele




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