GNOME Bugzilla – Bug 584228
const int compiles into unparenthesized define
Last modified: 2009-06-26 06:25:25 UTC
I'm using Vala 0.7.3. The compiler turns a const int into a #define which is not surrounded by parentheses, yielding trouble. To see the problem: == const int sum = 2 + 2; void main() { stdout.printf("%d\n", 2 * sum); } == The program prints 6, which is wrong. The generated .c file contains the following: #define sum 2 + 2
commit d6dbfa265da427618cac87365cdf0a39f01c3f0c Author: Jürg Billeter <j@bitron.ch> Date: Thu Jun 25 19:12:34 2009 +0200 Add parenthesis to macro substitutions where necessary Based on patch by Yu Feng.