Re: [Vala] Sorting a GLib.List<string>



On Sat, Sep 26, 2009 at 10:26:41AM +0100, Magnus Therning wrote:
What function should I use to sort a list of strings to avoid the
compiler warning I get with strcmp:

  ...
  my_list.sort( strcmp );
  ...

Test.vala:60: warning: passing argument 2 of ‘g_list_sort’ from
incompatible pointer type
/usr/include/glib-2.0/glib/glist.h:101: note: expected
‘GCompareFunc’ but argument is of type ‘int (*)(const char *, const
char *)’

GLib.strcmp() seems right to me. Vala should probably cast it to
GCompareFunc in the C code.


-- 
Julian Andres Klode  - Debian Developer, Ubuntu Member

See http://wiki.debian.org/JulianAndresKlode and http://jak-linux.org/.

Attachment: signature.asc
Description: Digital signature



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