Re: [Vala] Function to sort a list of strings?



On Thu, Jul 14, 2011 at 03:30:36PM +0200, Christian Siefkes wrote:
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?

Ignore it.

-- 
http://www.debian.org - The Universal Operating System



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