This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] string/stratcliff.c: Replace int with size_t [BZ #21982]


On Mon, 21 Aug 2017, H.J. Lu wrote:

> On Mon, Aug 21, 2017 at 6:23 AM, Joseph Myers <joseph@codesourcery.com> wrote:
> > On Sun, 20 Aug 2017, H.J. Lu wrote:
> >
> >> @@ -101,7 +101,7 @@ do_test (void)
> >>
> >>             if (STRLEN (&adr[outer]) != (size_t) (inner - outer))
> >>               {
> >> -               printf ("%s flunked for outer = %d, inner = %d\n",
> >> +               printf ("%s flunked for outer = %Zd, inner = %Zd\n",
> >
> > I don't think we should be using legacy %Z in any new code.  Use C99 %zu
> > for size_t (%zd only if the argument is the corresponding signed type
> > rather than size_t itself).
> >
> 
> There are some %Zd in string/stratcliff.c.  Should they be changed?
> Since All of them are size_t, I will replace %Zd with %zu.

In my view it makes sense to clean up existing uses of %Z legacy formats, 
provided there is still stdio test coverage that %Z behaves as expected.

-- 
Joseph S. Myers
joseph@codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]