From owner-freebsd-audit Sun Sep 23 14:30:23 2001 Delivered-To: freebsd-audit@freebsd.org Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by hub.freebsd.org (Postfix) with ESMTP id 4E17637B416 for ; Sun, 23 Sep 2001 14:30:18 -0700 (PDT) Received: from bde.zeta.org.au (bde.zeta.org.au [203.2.228.102]) by mailman.zeta.org.au (8.9.3/8.8.7) with ESMTP id HAA32581; Mon, 24 Sep 2001 07:30:10 +1000 Date: Mon, 24 Sep 2001 07:29:39 +1000 (EST) From: Bruce Evans X-X-Sender: To: Cc: Subject: Re: cvs commit: src/usr.sbin/sysinstall command.c config.c In-Reply-To: <20010923021751.A6105@windriver.com> Message-ID: <20010924072107.K17957-100000@delplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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