Re: g_slist_foreach and single arg functions
- From: Owen Taylor <otaylor redhat com>
- To: Mike <logan dct com>
- Cc: gtk-list gnome org
- Subject: Re: g_slist_foreach and single arg functions
- Date: Tue, 28 Oct 2003 16:38:41 -0500
On Tue, 2003-10-28 at 15:59, Mike wrote:
> Heya,
>
> I've seen a number of applications and libraries such as pango
> using g_slist_foreach(list, (GFunc) g_free, NULL); and other single
> argument functions.
>
> GFunc is typed out to two args, and g_slist_foreach calls the passed
> function with two args (eg. g_free(list->data, NULL)). This works,
> but is it proper c? Would some compilers complain?
It's not guaranteed by the C standard, but it can be assumed to work
everywhere that matters. (Everywhere GLib runs anyways.)
Compilers won't complain as long as the cast is there.
Regards,
Owen
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]