Re: [Vala] Conditional compilation: Passing #ifdefs through to generated C code
- From: Michael Terry <mike mterry name>
- To: vala-list gnome org
- Subject: Re: [Vala] Conditional compilation: Passing #ifdefs through to generated C code
- Date: Tue, 24 Mar 2009 08:36:00 -0400
On Mon, Mar 23, 2009 at 9:57 PM, Mike Massonnet <mmassonnet gmail com> wrote:
You have to run manually the source through cpp, it's a hack that
allows you to use #if's inside a Vala source. IMHO it is better to
tell on which Vala version you depend given the fact that Vala provides
Vapi files that may not work for older version of Gtk+.
That shouldn't be true. GTK+ will only add symbols, not change or
delete existing symbols (unless they go to 3.0 or something, in which
case there would be a different vapi file).
As for cpp hack, I don't think that would work. Again, I don't want
to conditionally compile the Vala code. I want to conditionally
compile the generated C code. That is, I want some mechanism to have
Vala put the #ifdef in the code it generates.
If you really need to write code to be portable through different
versions, I suggest C. Don't take my word however, I don't know Vala
very well.
It's true that I could have a small C file that I compile with the
rest of the Vala code that contains the #ifdefs. But this seems like
a common enough pattern (supporting optional features in new versions
of libraries) that Vala should support it. And it is usually only
used for small snippets of code, for which it quickly becomes annoying
to have to have a separate file.
-mt
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]