#50205 - GCallback should not be a void pointer
- From: Owen Taylor <otaylor redhat com>
- To: timj gtk org
- Cc: gtk-devel-list gtk org
- Subject: #50205 - GCallback should not be a void pointer
- Date: 26 Mar 2001 16:37:42 -0500
Having GCallback be a void * is particularly evil because
casts between void * and are function pointer are not allowed
by ANSI C, but gcc -Wall doesn't warn about them.
So, this is just an open invitation for people to write 
code that is not portable to compilers other than gcc.
Providing a real function pointer typedef for GCallback
will force people to use the G_CALLBACK() macro.
Can I commit?
                                        Owen
Index: gclosure.h
===================================================================
RCS file: /cvs/gnome/glib/gobject/gclosure.h,v
retrieving revision 1.8
diff -u -r1.8 gclosure.h
--- gclosure.h  2001/03/18 04:44:37     1.8
+++ gclosure.h  2001/03/26 21:36:56
@@ -33,7 +33,7 @@
 /* -- typedefs --- */
 typedef struct _GClosure                GClosure;
 typedef struct _GClosureNotifyData      GClosureNotifyData;
-typedef        gpointer                         GCallback;
+typedef        void  (*GCallback)              (void);
 typedef void  (*GClosureNotify)                (gpointer        data,
                                         GClosure       *closure);
 typedef void  (*GClosureMarshal)       (GClosure       *closure,
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]