R
ray.webster
Should the following work *if* I have a c99 compiler please?
#include <stdio.h>
int main(void)
{
size_t t = 42;
# if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
/* C99, so it should support %zu?
*/
printf("%zu", t);
# else
/* Not a C99 compiler - use lu.
*/
printf("%lu", (unsigned long)t);
# endif
return 0;
}
I'm using gcc 3.4.2 and the output is zu, this, I believe, shows that
the printf supplied doesn't recognize %zu as a valid format specifier?
BTW, where would you use plain ol' %z, vs. %zu, i.e, for what data
type?
Ta,
rayw
#include <stdio.h>
int main(void)
{
size_t t = 42;
# if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
/* C99, so it should support %zu?
*/
printf("%zu", t);
# else
/* Not a C99 compiler - use lu.
*/
printf("%lu", (unsigned long)t);
# endif
return 0;
}
I'm using gcc 3.4.2 and the output is zu, this, I believe, shows that
the printf supplied doesn't recognize %zu as a valid format specifier?
BTW, where would you use plain ol' %z, vs. %zu, i.e, for what data
type?
Ta,
rayw