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
- From: Tim Rice <tim [at] multitalents.net>
- To: nss-pam-ldapd-users [at] lists.arthurdejong.org
- Subject: Re: [PATCH] warnings cleanup: size_t should be formatted %lu rather than %d
- Date: Wed, 11 Mar 2015 11:47:57 -0700 (PDT)
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.
| @see man 3 printf -> The length modifier
|
| But IIRC the most important part is "z" modifier and warning is not printed
| if number is unsigned or not ("d" or "u"). So you can use either "%zd" or
"%zu"
| for size_t and ssize_t variables
|
| LS
|
--
Tim Rice Multitalents
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/