Date: Tue, 21 Jan 2003 21:06:27 +0300 From: "Eli Zaretskii" Sender: halo1 AT zahav DOT net DOT il To: djgpp-workers AT delorie DOT com Message-Id: <2110-Tue21Jan2003210627+0200-eliz@is.elta.co.il> X-Mailer: emacs 21.3.50 (via feedmail 8 I) and Blat ver 1.8.9 In-reply-to: <3E2D52C7.70E1DDEB@phekda.freeserve.co.uk> (message from Richard Dawe on Tue, 21 Jan 2003 14:01:43 +0000) 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> Reply-To: djgpp-workers AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp-workers AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk > Date: Tue, 21 Jan 2003 14:01:43 +0000 > From: Richard Dawe > > Well, we still seem to have ssize_t defined as an int and size_t defined as a > long. I'm currently coding up support for the 'z' conversion qualifier for > printf. This specifies that the following integer is of size_t or some > equivalent sized thing. This is the kind of code that should work IMHO: > > #include > #include > #include > > int > main (void) > { > ssize_t foo = 5; > > printf("%zd\n", foo); > return(EXIT_SUCCESS); > } > > When I compile it, I get this warning: > > gcc @../../../gcc.opt -I. -I- -I../../../../include -c foo.c > cc1.exe: warnings being treated as errors > foo.c: In function `main': > foo.c:17: warning: signed size_t format, ssize_t arg (arg 2) > make.exe: *** [foo.o] Error 1 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?