Re: Function pointer casts
- From: Morten Welinder <mortenw gnome org>
- To: Kevin Connor Arpe <kevinarpe gmail com>
- Cc: gtk-devel-list gnome org
- Subject: Re: Function pointer casts
- Date: Wed, 26 Dec 2012 11:20:35 -0500
> This code casts GCompareFunc to GCompareDataFunc. As I understand, casting
> function pointers in C is not allowed.
You're right, of course, but considering that the signal code
depends heavily on casting function pointers with no obvious
completely standard-sanctioned substitute, there's really
no reason to single out this particular cast. In practice
it works just fine anyway where you are likely to get
glib/gobject to run anyway.
The same problem occurs in any code using dlsym, such
as GModule. To use that you need to cast a data pointer to
a function pointer which isn't allowed (unless the thing you
cast is a null pointer constant and then it isn't really that
interesting).
Morten
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]