[quagga-dev 4374] Re: bgpd printf size_t warning
Andrew J. Schorr
aschorr at telemetry-investments.com
Wed Sep 20 14:53:05 BST 2006
On Wed, Sep 20, 2006 at 09:47:58AM -0400, Greg Troxel wrote:
> "Andrew J. Schorr" <aschorr at telemetry-investments.com> writes:
> > That begs the question: are you aware of any platforms where
> > a size_t has more bits than an unsigned long (since you seem to
> > be suggesting that this patch is not generally OK)?
> No, I am not, but to my knowledge that situation isn't precluded by
> any standard.
> I really doubt a system would have sizeof(size_t) > sizeof(unsigned
> long). I was making the argument that the range of values would be
> small, and thus there would be no errors arising from the cast.
> In this particular case, static analysis shows that the sizes will be
> really small.
Understood. I'm not trying to be difficult, just trying to arrive
at a consensus on the canonically correct way to printf a size_t
(until such time as %z is available on all supported platforms).
Is there some better way then using %lu and casting to (u_long)?
More information about the Quagga-dev