[U-Boot] [PATCH] cmd_fdt.c: Use %p when printing pointers

Wolfgang Denk wd at denx.de
Tue Oct 30 20:04:40 CET 2012


Dear Joe,

In message <CANr=Z=bxwwKkpUa_UzegN=E=TuqzeNUDTtZe7fDC+iCU9B6+3g at mail.gmail.com> you wrote:
>
> > 1) Handle this locally, say like that:
...
> I think this solution is not needed.  In this particular case, we are
> always printing the pointer to a member inside the fdt, so even if the
> image is at 0, no pointer that we are printing will ever be at 0.
> Therefore this is code that will never run and can be left out.

If we would decide for this variant, such reasoning should be
explained in a comment.

> >    Would anybody shed any tears if we drop this?
> 
> Getting rid of this would be good in general IMO.  I never did
> understand why printing "(null)" was better than "0".

I guess for the same reasons we are forced^W encouraged to write NULL
instead of 0 .

In the standard C library it certainly makes sense to note
specifically if one tries to dereference a NULL pointer, because this
is aways a bug.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
I have never understood the female capacity to avoid a direct  answer
to any question.
	-- Spock, "This Side of Paradise", stardate 3417.3


More information about the U-Boot mailing list