lists.arthurdejong.org
RSS feed

Re: [PATCH] warnings cleanup: size_t should be formatted %lu rather than %d

[Date Prev][Date Next] [Thread Prev][Thread Next]

Re: [PATCH] warnings cleanup: size_t should be formatted %lu rather than %d



On (11/03/15 11:47), Tim Rice wrote:
>On Wed, 11 Mar 2015, Lukas Slebodnik wrote:
>
>| On (11/03/15 10:55), Patrick McLean wrote:
>| >In several places the code uses a %d format to print a size_t variable.
>| >On amd64 at least size_t is an unsigned long, so use %lu instead.
>| That's not good approach. The size differs on 32-bit platforms (ix86)
>| 
>| You should use "%zd" for size_t variable
>| and "%zu" for ssize_t variable.
>
>Only if you do not care about portability.
>Some platforms do not have the z modifier.
>
It is part of c99 standard
@see section 7.21.6.1 draft[1]. (page 311)

Which platform do you mean and what solution is more portable?
"%lu" fix warning just on specific architectures.

LS

[1] http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf
-- 
To unsubscribe send an email to
nss-pam-ldapd-users-unsubscribe@lists.arthurdejong.org or see
http://lists.arthurdejong.org/nss-pam-ldapd-users/