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 Wed, 11 Mar 2015, Lukas Slebodnik wrote:

| 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.

The UnixWare 7.1.4 native compiler is still on C89.
But then come to think of it, the montonic clock changes between 0.9.1
and 0.9.2 broke my UnixWare build anyway so if I had to patch for "%zd"
and "%zu", it would be minor.

| LS
| 
| [1] http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf
| 

-- 
Tim Rice                                Multitalents    (707) 456-1146
tim@multitalents.net


-- 
To unsubscribe send an email to
nss-pam-ldapd-users-unsubscribe@lists.arthurdejong.org or see
http://lists.arthurdejong.org/nss-pam-ldapd-users/