Mail Archives: djgpp-workers/2003/01/21/14:08:09
> Date: Tue, 21 Jan 2003 14:01:43 +0000
> From: Richard Dawe <rich AT phekda DOT freeserve DOT co DOT uk>
>
> 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 <stdio.h>
> #include <stdlib.h>
> #include <sys/types.h>
>
> 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?
- Raw text -