tech-userlevel archive

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

Re: Defining more PRIxxx macros



On Sat, 17 Jan 2009, Martin Husemann wrote:
> On Sat, Jan 17, 2009 at 10:53:08AM +0200, Alan Barrett wrote:
> >     off_t -> PRIdOFF, PRIiOFF, PRIoOFF, PRIuOFF, ...
> >     [s]size_t -> PRIdSIZE, PRIiSIZE, PRIoSIZE, PRIuSIZE, ...
> 
> Why size_t? C99 has defined formats modifiers for size_t (z) and
> ptrdiff_t (t). So using %zu to print a size_t is more portable than
> "%" PRIuSIZE.

For consistency and ease of use.  I want to be able to print a foo_t
with PRIdFOO without first having to answer the question "is foo_t one
of the few types that has it's own special "%?d" format instead?"

The fact that both "%jd" and PRIdMAX exist is a kind of precedent for
this.

--apb (Alan Barrett)


Home | Main Index | Thread Index | Old Index