Re: #50205 - GCallback should not be a void pointer



On 26 Mar 2001, Owen Taylor wrote:

> 
> 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?

what's bad about typedef void (*GCallback) (); special cased
for non-c++ use use?

>                                         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,
> 

---
ciaoTJ





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