[Vala] Function to sort a list of strings?



Hi all,

I use the following, straightforward code to sort a List<string>:

        dupl_keys.sort(strcmp);

That works fine, but when I invoke valac (v0.13.1 or 0.12) to compile the
program, I get a warning:

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

Since the sorting itself works fine, I'm not unduly worried, but I still
wonder what's the cause of the warning. Should I use some other function
instead of strcmp to sort list of strings? If so, which one?

Best regards
        Christian

-- 
|------- Dr. Christian Siefkes ------- christian siefkes net -------
| Homepage: http://www.siefkes.net/ | Blog: http://www.keimform.de/
|    Peer Production Everywhere:       http://peerconomy.org/wiki/
|---------------------------------- OpenPGP Key ID: 0x346452D8 --
- "If you kiss me, I'll turn into a beautiful princess."
- "Look, I'm a computer programmer. I don't have time for girls, but a
  talking frog is very cool."

Attachment: signature.asc
Description: OpenPGP digital signature



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