From owner-cvs-all Sun Sep 23 10:49:38 2001 Delivered-To: cvs-all@freebsd.org Received: from glatton.cnchost.com (glatton.cnchost.com [207.155.248.47]) by hub.freebsd.org (Postfix) with ESMTP id ED7CC37B422; Sun, 23 Sep 2001 10:49:31 -0700 (PDT) Received: from bitblocks.com (adsl-209-204-185-216.sonic.net [209.204.185.216]) by glatton.cnchost.com id NAA01962; Sun, 23 Sep 2001 13:49:28 -0400 (EDT) [ConcentricHost SMTP Relay 1.14] Message-ID: <200109231749.NAA01962@glatton.cnchost.com> To: Bruce Evans Cc: Murray Stokely , cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: Re: cvs commit: src/usr.sbin/sysinstall command.c config.c In-reply-to: Your message of "Sun, 23 Sep 2001 18:06:02 +1000." <20010923180124.I13390-100000@delplex.bde.org> Date: Sun, 23 Sep 2001 10:49:28 -0700 From: Bakul Shah Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG > > 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. I have an old (1997) working draft of C9X which says 6.2.2.3 Pointers [#1] A pointer to void may be converted to or from a pointer to any incomplete or object type. A pointer to any incomplete or object type may be converted to a pointer to void and back again; the result shall compare equal to the original pointer. Since any object ptr may be converted to %p, you can do, e.g. printf("...%p...", ..., (void*)&some_function, ...); But you seem to be saying this is not be a valid conversion. Have things changed since then or is a function not considered an "object"? I would appreciate a C standard reference ( i.e. chapter and verse!) that shows this is invalid. At any rate %p is preferable to %x or %lx even if not properly pedantic. I have used machines with segmented address space (an NEC unix machine in mid80s though I forget the model number) where %p would give you : but %x or %lx would be wrong. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message