[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: warning in mingw [Was: [ANN] Lua 5.4.0 (rc1) now available]
- From: William Ahern <william@...>
- Date: Fri, 24 Apr 2020 20:14:18 -0700
On Fri, Apr 24, 2020 at 02:07:24PM -0300, Roberto Ierusalimschy wrote:
<snip>
> What none of these references explains is why gcc complains when casting
> to 'void(*)()' or to any other function pointer, but does not complain
> when casting to 'void(*)(void)'. Unlike (void*) for objects, the type
> 'void(*)(void)' has nothing special about it to prevent warnings.
>
> From the point of view of the standard, is all the same. As long as you
> keep the reference as a pointer to function (any function!), and cast
> it to the correct type when calling it, everything is guaranteed to work.
> Why 'void(*)(void)' would be special? Do other compilers have this
> same behavior, or is this a gcc kludge?
As far as I understand from reading proposals and following various
discussions it seems likely that the next C standard, C2x, will remove
support for empty argument lists in function prototypes. I presume that
means it will also no longer be supported in function type declarations.
What I've read has been silent on that point, even though function type
declarations, and especially function pointer type declarations, are IME the
most common use for empty argument lists in modern C code.
_______________________________________________
lua-l mailing list -- lua-l@lists.lua.org
To unsubscribe send an email to lua-l-leave@lists.lua.org