Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 24 Sep 2001 18:23:30 -0700
From:      Bakul Shah <bakul@bitblocks.com>
To:        Bruce Evans <bde@zeta.org.au>
Cc:        Murray Stokely <murray@FreeBSD.org>, cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org
Subject:   Re: cvs commit: src/usr.sbin/sysinstall command.c config.c 
Message-ID:  <200109250123.VAA01656@glatton.cnchost.com>
In-Reply-To: Your message of "Mon, 24 Sep 2001 08:13:47 %2B1000." <20010924074613.F18180-100000@delplex.bde.org> 

next in thread | previous in thread | raw e-mail | index | archive | help
> 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 <seg>:<addr> or just <addr>.  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




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