fb39ca4 / picoc

Automatically exported from code.google.com/p/picoc
0 stars 0 forks source link

Ternary operator executes both sides #184

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Consider:
    int a = 1;
    a?printf("a!=0\n"):printf("a==0\n");

Based on this, since a == 1 (rather, since a != 0), only "a!=0" should be 
printed. If instead is set to 0, only "a == 0" should be printed.

Regardless of the value of a, both printf()s are performed.

This is using picoc 2.1 on OS X.

Original issue reported on code.google.com by m...@heilpern.com on 2 Jul 2013 at 1:35