public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Vincent Lefevre <vincent+gcc@vinc17.org>
To: Segher Boessenkool <segher@kernel.crashing.org>
Cc: gcc-help@gcc.gnu.org, Josef Wolf <jw@raven.inka.de>
Subject: Re: How to print pointer to function?
Date: Tue, 17 Dec 2019 15:23:00 -0000	[thread overview]
Message-ID: <20191217152328.GD458941@cventin.lip.ens-lyon.fr> (raw)
In-Reply-To: <20191217132204.GK3152@gate.crashing.org>

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)

  reply	other threads:[~2019-12-17 15:23 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-12  9:30 Josef Wolf
2019-12-12  9:44 ` Jonathan Wakely
2019-12-12  9:49 ` Liu Hao
2019-12-12 11:00   ` Josef Wolf
2019-12-17 12:56     ` Vincent Lefevre
2019-12-17 13:17       ` Liu Hao
2019-12-17 13:27         ` Segher Boessenkool
2019-12-17 14:52         ` Vincent Lefevre
2019-12-17 13:22       ` Segher Boessenkool
2019-12-17 15:23         ` Vincent Lefevre [this message]
2019-12-17 15:27         ` Manfred
2019-12-17 16:30           ` Vincent Lefevre
2019-12-17 22:49             ` Segher Boessenkool
2019-12-18  2:39             ` Liu Hao
2019-12-18 10:05               ` David Brown
2019-12-18 11:12                 ` Segher Boessenkool
2019-12-17 13:01 ` Vincent Lefevre

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191217152328.GD458941@cventin.lip.ens-lyon.fr \
    --to=vincent+gcc@vinc17.org \
    --cc=gcc-help@gcc.gnu.org \
    --cc=jw@raven.inka.de \
    --cc=segher@kernel.crashing.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).