How to print pointer to function?

Vincent Lefevre vincent+gcc@vinc17.org
Tue Dec 17 15:23:00 GMT 2019


On 2019-12-17 07:22:04 -0600, Segher Boessenkool wrote:
> On Tue, Dec 17, 2019 at 01:56:48PM +0100, Vincent Lefevre wrote:
> > Here your code is still non-portable, perhaps *more* non-portable,
> > as only conversions between intptr_t and void * are guaranteed to
> > work. Moreover, the intptr_t type is optional.
> 
> Any object pointer, sure (since you can convert those to pointer to
> void and back again).

Yes, but to be safe, you need to use void * as an intermediate type
in the conversion.

BTW, this does not mean that the conversion is lossless, as I suppose
that a pointer type may carry more information than just the address
of the object. But I think that this does not matter here.

-- 
Vincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)



More information about the Gcc-help mailing list