bug-gnubg
[Top][All Lists]
Advanced

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

Re: [Bug-gnubg] icc/gcc Compiler warnings


From: Jim Segrave
Subject: Re: [Bug-gnubg] icc/gcc Compiler warnings
Date: Wed, 28 Mar 2007 17:01:15 +0200
User-agent: Mutt/1.4.2.1i

On Wed 28 Mar 2007 (09:31 +0200), Christian Anthon wrote:
> Hi all,
> 
> after some multidimensional arrays are declared const in function
> arguments I get compiler warnings on gcc/icc. I guess it boils down
> to:
> 
> http://c-faq.com/ansi/constmismatch.html
> 
> and then there is this icc warning as well:
> 
> gtkwindows.c(122): warning #556: a value of type "void *" cannot be
> assigned to an entity of type "void (*)(GtkWidget *, void *)"
>        cbData->DialogFun = (void*)okFun;
> 
> the cast seems to work, but it is ugly.


It's wrong. Function pointers are not guaranteed to fit in oridinary
pointer types. The case should really be to a function pointer:

typedef void (*dialog_func_ty)(GtkWidget *, void*);

cbData->DialogFun = (dialog_func_ty) okFun;

Should compile without errors or warnings.


-- 
Jim Segrave           address@hidden




reply via email to

[Prev in Thread] Current Thread [Next in Thread]