Re: #50205 - GCallback should not be a void pointer
- From: Owen Taylor <otaylor redhat com>
- To: Tim Janik <timj gtk org>
- Cc: gtk-devel-list gtk org
- Subject: Re: #50205 - GCallback should not be a void pointer
- Date: 28 Mar 2001 10:31:51 -0500
Tim Janik <timj gtk org> writes:
> 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?
a) Special casing for C++ is evil. For example, older versions of
G++ are buggy and treat empty parens inside extern "C" in the C
manner, unless -pedantic is specified. This causes code compiled
with -pendantic to have different mangling.
b) Empty parens to mean "unspecified" is IIRC explicitely deprecated
in C99.
Regards,
Owen
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]