How to print pointer to function?

Jonathan Wakely jwakely.gcc@gmail.com
Thu Dec 12 09:44:00 GMT 2019


On Thu, 12 Dec 2019 at 09:30, Josef Wolf <jw@raven.inka.de> wrote:
>
> Hello,
>
> I would like to print the pointer to a function for debugging purposes.
>
> But I keep getting a warning:
>
>   ttt.c: In function 'insert_transfer':
>   ttt.c:7:37: warning: ISO C forbids conversion of function pointer to object pointer type [-Wpedantic]
>       7 |     printf ("lost transfer %p\r\n", (void*)rdyfunc);
>
> Is there any way to get rid of this warning?

Isn't it pretty clear the warning comes from -Wpedantic?

So don't use -Wpedantic (or the equivalent -pedantic).

If you want to write non-standard code without warnings, don't enable
pedantic warnings.



More information about the Gcc-help mailing list