Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 24 Sep 2001 07:29:39 +1000 (EST)
From:      Bruce Evans <bde@zeta.org.au>
To:        <murray@stokely.org>
Cc:        <freebsd-audit@FreeBSD.org>
Subject:   Re: cvs commit: src/usr.sbin/sysinstall command.c config.c
Message-ID:  <20010924072107.K17957-100000@delplex.bde.org>
In-Reply-To: <20010923021751.A6105@windriver.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, 23 Sep 2001 murray@stokely.org wrote:

> On Sun, Sep 23, 2001 at 06:06:02PM +1000, Bruce Evans wrote:
> > >   Silence warnings on alpha :
> > >
> > >     Use '%p' when printing out the address of a function.
> > >     sizeof(int) != sizeof(long)
> >
> > %p is for printing pointers of type "void *".  It is unsuitable for
> > printing arbitrary pointers to objects.  It is especially unsuitable
> > for printing pointers to functions.
>
>   Hmm.  What should be used instead?

There is no portable way.  Unportable ways:
1) Any object can be printed by treating it as an array of bytes.
2) Program profiling in FreeBSD assumes that there is an integral type
   uintfptr_t that can represent function pointers in the same way that
   the standard type uintptr_t can represent "void *"'s (if it exists).
   It's interesting that tcc (Tendra C) permits casting pointers to
   functions to int but not to "void *".

Bruce


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-audit" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010924072107.K17957-100000>