From owner-cvs-all Mon Sep 24 18:23:40 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 6802B37B409; Mon, 24 Sep 2001 18:23:33 -0700 (PDT) Received: from bitblocks.com (adsl-209-204-185-216.sonic.net [209.204.185.216]) by glatton.cnchost.com id VAA01656; Mon, 24 Sep 2001 21:23:30 -0400 (EDT) [ConcentricHost SMTP Relay 1.14] Message-ID: <200109250123.VAA01656@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 "Mon, 24 Sep 2001 08:13:47 +1000." <20010924074613.F18180-100000@delplex.bde.org> Date: Mon, 24 Sep 2001 18:23:30 -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 > Functions aren't objects, and incomplete types aren't for functions. > Reference supplied by TenDRA C for (void *)&some_function: Thanks! > This is machine-dependent. Another example: for i386's in real mode, > pointers can be : or just . There are 4 memory > "models" corresponding to the 2 independent choices for function and > object pointers. %p doesn't work for large function pointers mixed > with small data pointers or vice versa. OTOH, %x or %lx (the one for > ints of the same size as the pointer being printed) does something > reasonable if not correct. I thought this (multiple models) was precisely the reason why %p was added. You link with the correct model library (depending on how you compile your source file) and the right thing happens. Also note that mixing models in the same program would force you to use `far' or `near' keyword (something wisely left out of the standard) when you used a ptr of the non-default model and since this is not a standard ptr, all bets are off. So I still say %p should be used. I never understood the restriction of why a function ptr can't be cast to void*. It is not like you are going to create self-modifying functions..... Using %x or %lx for printing a fn ptr is as wrong as using %p. And to me %p is likely to be the better choice. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message