[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: test-base64 warnings
From: |
Simon Josefsson |
Subject: |
Re: test-base64 warnings |
Date: |
Fri, 30 May 2008 14:02:25 +0200 |
User-agent: |
Gnus/5.110009 (No Gnus v0.9) Emacs/22.2 (gnu/linux) |
Bruno Haible <address@hidden> writes:
> Simon Josefsson wrote:
>> (I wish there was a PRI macro for size_t types...)
>
> According to ISO C 99, you can use "%zu" to print a size_t value. But it's
> not portable enough, and it'd be overkill to activate the printf replacement
> just for the tests.
$.2 idea:
Add two macros that allows you to write:
size_t len;
printf ("len: %" PRIz "\n", PRIzCAST(len));
If the system printf supports %zu, or if the gnulib printf module that
supports %zu is enabled, the macros would be defined as:
#define PRIz "zu"
#define PRIzCAST(x) (x)
Otherwise, the macros would be defined as:
#define PRIz "lu"
#define PRIzCAST(x) ((unsigned long)x)
Thoughts?
I'm not sure this is a good idea, the code is slightly unreadable. On
the other hand, the current code is slightly unreadable already:
printf ("len: %lu\n", (unsigned long) len);
/Simon