lua-users home
lua-l archive

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

> >From the documentation of GCC 9.3.0:
> -Wcast-function-type
> Warn when a function pointer is cast to an incompatible function pointer.
> In a cast involving function types with a variable argument list only the
> types of initial arguments that are provided are considered. Any parameter
> of pointer-type matches any other pointer-type. Any benign differences in
> integral types are ignored, like int vs. long on ILP32 targets. Likewise
> type qualifiers are ignored. The function type void (*) (void) is special
> and matches everything, which can be used to suppress this warning. In a
> cast involving pointer to member types this warning warns whenever the type
> cast is changing the pointer to member type. This warning is enabled by
> -Wextra.

So, this is a documented GCC thing. Many thanks for the info.

I would support not using this warning, but as it comes with -Wextra
we would need to explicitly turn it off.

We already have several constructions in our code base to avoid
warnings from specific compilers (virtually all warnings are from
specific compilers), such as FALLTHROUGH comments, useless returns
and breaks, useless initialisations, extra parentheses in dubious
expressions, etc. Adding this cast (with a proper comment) doesn't hurt.

-- Roberto
lua-l mailing list --
To unsubscribe send an email to