Sender: rich AT phekda DOT freeserve DOT co DOT uk Message-ID: <3E2DBF23.2EF2702@phekda.freeserve.co.uk> Date: Tue, 21 Jan 2003 21:44:03 +0000 From: Richard Dawe X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.2.23 i586) X-Accept-Language: de,fr MIME-Version: 1.0 To: djgpp-workers AT delorie DOT com Subject: Re: size_t and ssize_t References: <200106192104 DOT XAA18859 AT father DOT ludd DOT luth DOT se> <3E2D52C7 DOT 70E1DDEB AT phekda DOT freeserve DOT co DOT uk> <2110-Tue21Jan2003210627+0200-eliz AT is DOT elta DOT co DOT il> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Reply-To: djgpp-workers AT delorie DOT com 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/ ]