Re: [Vala] array declaration
- From: Harry Van Haaren <harryhaaren gmail com>
- To: pancake <pancake youterm com>
- Cc: vala-list gnome org
- Subject: Re: [Vala] array declaration
- Date: Wed, 7 Jul 2010 17:33:40 +0100
Hey,
Coming from a C++ background I first tried typeHere nameHere[]; too.
I noticed that newer languages seemed to have type[] name; configuration
(Java, C# etc).
I'm not part of the Vala team though, so I dont know the "official" status!
-Harry
On Wed, Jul 7, 2010 at 5:15 PM, pancake <pancake youterm com> wrote:
I have noticed that if you declare an array in a wrong way you get errors
from the C compiler
instead of handling it at vala level.
should this syntax be supported? or we should just throw an error?
Here's the test case:
$ cat a.vala
#!/usr/bin/vala
void main () {
// uint8[] foo = new uint8[16]; // OK
uint8 foo[] = new uint8[16]; // FAIL
print("%d\n", foo[0]);
}
$ vala a.vala
/tmp/a.vala.LDAGFV.c: In function '_vala_main':
/tmp/a.vala.LDAGFV.c:16:9: error: array size missing in '_tmp0_'
/tmp/a.vala.LDAGFV.c:19:9: error: array size missing in 'foo'
/tmp/a.vala.LDAGFV.c:20:16: error: incompatible types when assigning to
type 'guint8[1]' from type 'guint8 *'
/tmp/a.vala.LDAGFV.c:20:6: error: incompatible types when assigning to type
'guint8[1]' from type 'guint8 *'
/tmp/a.vala.LDAGFV.c:22:6: error: incompatible types when assigning to type
'guint8[1]' from type 'void *'
error: cc exited with status 256
Thanks
--pancake
_______________________________________________
vala-list mailing list
vala-list gnome org
http://mail.gnome.org/mailman/listinfo/vala-list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]