lilypond-devel
[Top][All Lists]
Advanced

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

Re: Selectively suppress -Wcast-function-type (issue 357770043 by addres


From: dak
Subject: Re: Selectively suppress -Wcast-function-type (issue 357770043 by address@hidden)
Date: Mon, 13 Aug 2018 05:55:38 -0700

On 2018/08/13 12:29:46, Dan Eble wrote:
On 2018/08/13 07:11:38, dak wrote:
> I'd use scm_func_cast<scm_t_blabla> (actual_func)

I'll do that.

> Any chance that an implementation via a double cast (with something
like void
*
> in between) will work?  Strictly speaking that's worse than casting
from one
> function pointer to another since function and data pointers need
not be the
> same size on segmented architectures, but lots of code does stuff
like that
> anyway.

The first thing I tried was an intermediate (void*), and that did
eliminate the
warning.  The reason you cite is the reason I didn't propose it, but
if you're
comfortable with it, I'll do it.  Interaction with Guile is not a
place where I
care to assert my preferences.

Personally, I think that we should rather disable this warning globally.
 An explicit cast is an explicit cast.  There would be a weak argument
that a C-style cast may expect an actual working conversion to take
place (and I have little enough sympathy with that argument), but an
explicit reinterpret_cast quite clearly states "shut up, I know what I
am doing".  So I don't really think that it's warranted to tap-dance
around GCC here and I'd rather stop GCC on the command line from
flagging this.

Apropos: what have you done about the warnings regarding SCM_UNPACK ?
Those use something like (0 ? *(SCM*)0 : ...) for type coercion/checking
and the resulting warnings clutter everything for me.  I'll likely
change my local Guile-1.8 source for quieting those.

https://codereview.appspot.com/357770043/



reply via email to

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