On Tue, Nov 16, 2010 at 12:28:23 -0800, Anatol Pomozov wrote: > But what if you want to change the real constant value at the > compile-time? A classical example is DEBUG vs OPTIMIZED mode. During > development I want to log of information to stdout, like this: > > if (DEBUG) { > stdout.printf("User ID is: $user"); > } > > and I don't want to have this code in the release version. To make it > happen one can use something like > > bool DEBUG=false; > > and compile the vala program with -DDEBUG (or its equivalent > -DDEBUG=true). This compiler flag changes the default value of the > const. > > Type-safety means that vala compile knows that DEBUG is boolean and > complains if someone tries to use number/string here (-DDEBUG=foo) or > tries to set value for unexisting constant.
You know, vala DOES support THAT. Simply #if DEBUG stdout.printf("USer ID is: $user"); #endif and than: valac -DDEBUG ... It is a flag -- either it's there or not. -- Jan 'Bulb' Hudec <b...@ucw.cz> _______________________________________________ vala-list mailing list vala-list@gnome.org http://mail.gnome.org/mailman/listinfo/vala-list