2016-01-05 14:32 GMT-08:00  <cinap_len...@felloff.net>:
>> there are usable ANSI formats for the difference and sizeof types.
>
> so one would write %td instead of %ld for ptrdiff type? that seems
> easy.

yes, and there's support for u/i/o/X/x/etc modifiers

> i'm not so sure how usize/ssize would work. %zud and %zd? or would
> the z flag imply unsigned? would the return type of sizeof() also
> become usize?

it depends on what you are trying to target. that's why i bring up
standards as soon as you start talking about this. size_t and
ptrdiff_t are part of C. ssize_t isn't.

ssize_t is a posix-ism and is defined to store "values at least in the
range [-1, {SSIZE_MAX}]". If you care about what C says, then you can
do anything you want with ssize, because it isn't part of C. For
printing, %zu is size_t (per C) and %zd is ssize_t (per POSIX).

--dho

> --
> cinap
>

Reply via email to