Re: [Vala] Define constant at compile time
- From: Jan Hudec <bulb ucw cz>
- To: Günther Wutz <admin wutzara de>
- Cc: vala-list gnome org
- Subject: Re: [Vala] Define constant at compile time
- Date: Tue, 16 Nov 2010 20:44:30 +0100
On Tue, Nov 16, 2010 at 18:51:12 +0100, Günther Wutz wrote:
It is possible to use cpp as Preprocessor. I'm working on a
wrapper-program to combine cpp and give it valac to compile. The easiest
way i found actually.
Sorry. That's an extremely bad idea for most cases.
The easiest way is to tell vala to emit the symbols that will then be defined
when compiling the generated C code. That way vala will guard you from name
conflicts and the code will be more readable.
In C, the preprocessor is generally used for two things:
- symbolic constants -- but real constants serve the purpose better and
- generic constructs -- but vala does have generics, so you don't need
those.
Even in C++ you usually avoid the preprocessor for most things, because
preprocessor symbols cannot be scoped. Which is doubly so applicable to vala.
--
Jan 'Bulb' Hudec <bulb ucw cz>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]