[Vala] Declare array of enumerated(enum) value size
- From: Kamanashis Roy Shuva <kamanashisroy gmail com>
- To: vala-list gnome org
- Subject: [Vala] Declare array of enumerated(enum) value size
- Date: Sun, 12 Aug 2012 18:10:00 +0600
Hi,
I was rewriting some of my (C)code in vala. I used to do the following in
my C code,
<pre>
enum {
#ifdef EMBEDED
MAX_EVENTS=2
#else
MAX_EVENTS=20
#endif
};
int statistics[MAX_EVENTS];
int foo[MAX_EVENTS];
int bar[MAX_EVENTS];
</pre>
Unfortunately I am not allowed to use enum identifier inside array
declaration. Is there any problem in this idea ? I mean this feature is
very useful.
I wanted to write code something like this,
<pre>
enum stats_parameters {
#ifdef EMBEDED
MAX_EVENTS=2
#else
MAX_EVENTS=20
#endif
}
int statistics[MAX_EVENTS];
int foo[MAX_EVENTS];
int bar[MAX_EVENTS];
</pre>
And if this feature is not feasible then do you know any work around ?
And if you think you like this idea, then can you please suggest me the
place to edit ? Because I have little experience working on your compiler
code..
--
-- Thanks
Kamanashis Roy
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]