Re: [Vala] Warning or Bug ?



On Wed, 2011-06-08 at 09:25 +0200, Serge Hulne wrote:
//----------------

// Struct to hold key, values pairs:

 struct pair {
     public int    freq;
     public string word;
 }


 // Equality function for structs :

 bool equals (pair a, pair b) {
     return (Posix.strcmp(a.word, b.word) == 0);
 }


 //List:

 var L = new LinkedList<pair?>( (EqualFunc) equals);

//---------------- 

Hi,

what is the warning? If I compile the snippet with the following command
I have any warning other than unused variables:

valac gee-warn.vala --pkg gee-1.0 --pkg posix

May be you haven't added the --pkg posix switch?

And do you know that you can use the glib wrap for strcmp?

Eg. return (GLib.strcmp(a.word, b.word) == 0);

Regards,
Andrea




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]