[Vala] Volatile is supported or not?
- From: Tal Hadad <tal_hd hotmail com>
- To: Vala Mail List <vala-list gnome org>
- Subject: [Vala] Volatile is supported or not?
- Date: Thu, 9 Aug 2012 11:23:22 +0300
I have to use volatile variables in my project. The alternative is to
allocate a new memory slice and use this pointer, or disable
optimizations.
Currently, when I define a field, variable or parameter with "volatile"
keyword, i get error, so I guess it's not supported yet.
However, here[0] it's mentioned it was suspended since it has
some bug. I don't know what is the current status of this.
Please support this keyword, or at least in CCode attribute.
Volatile has few advantage since the pointer to itself is constant:
1. It can safely be written or read into even after the call to the
method which take its pointer to it. e.g.:
volatile int some;
int* saved_pointer;
void save_ponter (volatile int* pointer) {
saved_pointer = pointer;
}
int read_ponter () {
return saved_pointer;
}
It can be safely done only with volatile keyword.
2. I'm not sure weather GLib.AtomicInt is safe without the
volatile keyword. I know that all this method defined in the C
header with a volatile parameters, but is CC makes a global
volatile variable, or it can makes a different volatile variable each
innovation?
Is volatile supported in Vala? If not, it realy should.
Most modern languages have this "feature", so I see no reason why
it shouldn't be in Vala.
Does Jürg Billeter include this in the language?
Tal
[0] http://web.archiveorange.com/archive/v/vLjdS6l4XaRgyE44fRQu
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]