John Levon writes:
> On Tue, Jul 29, 2008 at 05:44:34PM +0100, Nick Todd - Sun Microsystems wrote:
> > The C standard says that if you're passing %p as part of a variable 
> > argument string then the matching type must be (void *).
> 
> I wonder what the rationale is. Function descriptors? Can't think of
> anything else that actually occurs in practice (and definitely nothing
> that runs Solaris ;)

Function descriptors are one example.  In general, there's no
guarantee in C that a given pointer representation will be the same as
any other.  Passing as an argument then picking up (with stdarg, as
printf does) as a different type isn't guaranteed to work.

Of course, it *does* work on any reasonable machine, but lint doesn't
have to limit itself to reasonableness.  ;-}

-- 
James Carlson, Solaris Networking              <james.d.carlson at sun.com>
Sun Microsystems / 35 Network Drive        71.232W   Vox +1 781 442 2084
MS UBUR02-212 / Burlington MA 01803-2757   42.496N   Fax +1 781 442 1677

Reply via email to