brl: don't use conversion to float for offset and count

Volker Lendecke Volker.Lendecke at SerNet.DE
Wed Jun 4 22:47:32 MDT 2014


On Wed, Jun 04, 2014 at 07:32:44PM +0200, Ralph Böhme wrote:
> Hi Volker
> 
> On Tue, Jun 03, 2014 at 03:41:07PM +0200, Volker Lendecke wrote:
> > https://en.wikipedia.org/wiki/Inttypes.h
> > 
> > has PRIu64 as the format specifier for a uint64_t. If you
> > look deep inside
> > 
> > http://www.open-std.org/jtc1/sc22/WG14/www/docs/n1256.pdf
> > 
> > it seems that this is C99 standard these days. Samba does
> > already use this in various places.
> > 
> > I could not find a reference to "j" in C99, only in susv4.
> 
> page 277:
> 
>   Specifies that a following d, i, o, u, x, or X conversion specifier
>   applies to an intmax_t or uintmax_t argument; or that a following n
>   conversion specifier applies to a pointer to an intmax_t argument.
> 
> > Both are probably possible, but for orthogonality reasons I
> > would argue to settle on one of both.
> 
> I prefer casting to (u)intmax_t and using "j", because that makes the
> code ready for 128 bit.
> 
> But if you prefer I can convert to using the fixed size macros.

No, you just convinced me :-)

I don't really see yet the need to be 128-bit safe, but "j" and casting
to intmax_t is much nicer than PRIu64.

Reviewed-by: Volker Lendecke <vl at samba.org>

Volker

-- 
SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-370000-0, fax: +49-551-370000-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
http://www.sernet.de, mailto:kontakt at sernet.de


More information about the samba-technical mailing list