NetBSD-Users archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: C portability question
On Sun, 11 May 2008, Steven M. Bellovin wrote:
> Anyway -- what is the portable way to printf an off_t
For arbitrary opaque signed integer types, cast to intmax_t and print
with "%jd". For arbitrary opaque unsigned integer types, cast to
uintmax_t and print with "%ju". The "j" modifier is defined in the C99
standard, section 7.19.6.1 paragraph 7, and works in NetBSD. You can
also use PRIdMAX or PRIuMAX (defined in section 7.8.1 paragraphs 2 and
3).
The other advice you received, about casting to int64_t or something,
will probably work on NetBSD but is not portable to all C99
implementations.
--apb (Alan Barrett)
Home |
Main Index |
Thread Index |
Old Index