Mail Archives: djgpp-workers/2003/01/21/16:45:01
Hello.
Eli Zaretskii wrote:
[snip]
> Sorry, I don't get it: %z is defined to print size_t, not ssize_t,
> right? If so, why did you expect this snippet to compile without a
> warning? Does some standard say that ssize_t is interchangeable with
> size_t in this context?
In order: no, yes, yes. Here's what C99 says about "z" in section 7.19.7.1:
"z Specifies that a following d, i, o, u, x,or X conversion specifier applies
to a size_t or the corresponding signed integer type argument; or that a
following n conversion specifier applies to a pointer to a signed integer type
corresponding to size_t argument."
I think that ssize_t should be a signed integer type corresponding to size_t.
So I think %zd would display a ssize_t (or equivalent), %zu would display a
size_t (or equivalent), etc.
With our current definition of ssize_t, gcc generates a warning, because
size_t is a long int, but ssize_t is an int.
Bye, Rich =]
--
Richard Dawe [ http://www.phekda.freeserve.co.uk/richdawe/ ]
- Raw text -