Re: [Vala] Initialization Error!!!



Matias,

Please file this as bug in bugzilla
http://bugzilla.gnome.org

That way your bug report won't get lost

Jaap

2008/5/29 Matías De la Puente <mfpuente ar gmail com>:
Hello

The following code do not work because the value in 'x' and 'y' in 'd' are
not 24 and 3.
The structure is not initialized in an appropriate manner.

using GLib;

public class Sample : Object
{
    struct Data
    {
        public int x;
        public int y;
    }

    public static void main (string[] args)
    {
        int i = 24;
        int j = 3;
        Data d = {i, j};

        stdout.printf ("x = %d, y = %d\n", d.x, d.y);
    }
}


In the C code, I see that in the structure is initialized before the
variables:

    gint i;
    gint j;
    SampleData d = {i, j};
    i = 24;
    j = 3;


Can anyone fix this? Because when i work with pointer there is a
Segmentation Fault. Thanks

Matias

_______________________________________________
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]