lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-users] bug report


From: Kieran Mansley
Subject: Re: [lwip-users] bug report
Date: Fri, 05 Mar 2010 16:44:18 +0000

On Fri, 2010-03-05 at 11:31 -0500, Jeff Barber wrote:
> I can see a need for the Xnn_F stuff in a few cases (for example, with
> scanf so that it knows the integer size to store, or when printing
> something that might be longer than some machines' standard integer
> length such as u32_t on a 16-bit machine). However IMO it's really
> ugly and shouldn't be used unless needed.
> 
> Can you explain why it is necessary in this case?  The u8_t values
> should be automatically promoted to "standard integer" length.
> 
> (And, actually, the same argument can be made with respect to the
> u16_t type being printed here with %hx -- %x should work just fine
> with the standard promotion.)
> 
> Jeff

I think his point is that we're assuming that %x exists on his platform
by hardcoding %02x in the code, whereas on his platform he needs to use
something other than %x to get a hex output.

The shorter-than-32-bit modifiers are needed because we only want to
print out 2 characters for each byte of the MAC address.  If we just
used a standard %x or it got promoted as such you'd have very hard to
read MAC addresses being output.

Kieran 





reply via email to

[Prev in Thread] Current Thread [Next in Thread]