After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 128782 - GCClosure incorrectly uses gpointer for callback
GCClosure incorrectly uses gpointer for callback
Status: RESOLVED WONTFIX
Product: glib
Classification: Platform
Component: gobject
2.2.x
Other All
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2003-12-08 04:25 UTC by mental
Modified: 2011-02-18 16:14 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description mental 2003-12-08 04:25:42 UTC
GCClosure::callback should be a GCallback, not a gpointer.  This is also an issue in several 
related functions.

Casting the callback function pointer to a gpointer may cause problems on architectures 
(e.g. IA-64) where function pointers are not simple addresses, and in any case it is not 
permitted by the C standard.

Note the fifth bullet point in section 3.2.2.3 of the ANSI C rationale.

http://www.lysator.liu.se/c/rat/c2.html#3-2-2-3

I believe lint(1) will also complain about this. g++ 3.2 produces an error (e.g. when building 
a C++ program that uses g_signal_handlers_block_matched()).
Comment 1 Owen Taylor 2004-02-09 20:10:09 UTC
g_signal_handlers_block_matched() can't be changed without
API compatibilty breakage (we've noted this problem in
the past) and actually, there is no problem on ia64 or
other common architectures that I'm aware of... on ia64, 
function pointers are pointers to function descriptors, 
not the function descriptors themselves.

I suspect changing GClosure::callback is also a API change,
though it's pretty obscure what the details of the API are
in this area.

Comment 2 Matthias Clasen 2005-12-03 07:15:55 UTC
as repeatedly discussed