bug-gnulib
[Top][All Lists]
Advanced

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

Re: RFT: *printf-posix modules


From: Bruno Haible
Subject: Re: RFT: *printf-posix modules
Date: Thu, 24 May 2007 00:10:43 +0200
User-agent: KMail/1.5.4

Eric Blake wrote:
> > --- m4/printf.m4    22 May 2007 01:02:09 -0000
> > --- 138,163 ----
> >         AC_TRY_RUN([
> >   #include <stdio.h>
> >   #include <string.h>
> > + static int
> > + strisnan (const char *string, size_t start_index, size_t end_index)
> > + {
> > +   if (start_index < end_index)
> 
> I know you just copy-n-pasted strisnan across all the files where you added 
> it; 
> but in the .m4 file, where you only call strisnan with start_index of 0, it 
> might be simpler to get rid of the check for start_index<end_index since it 
> is 
> always true, or even remove the parameter start_index.

A function that assumes that a start_index is 0 is not necessarily more
easy to understand than a function that gets the start_index explicitly.

> > --- tests/test-snprintf-posix.h     22 May 2007 01:02:10 -0000
> > --- 396,402 ----
> >       /* "0000000nan 33" is not a valid result; see
> >          
> > <http://lists.gnu.org/archive/html/bug-gnulib/2007-04/msg00107.html> 
> */
> >       ASSERT (strlen (result) == 20 + 3
> > !       && strisnan (result, strspn (result, " "), strlen (result) - 3, 0)
> >         && strcmp (result + strlen (result) - 3, " 33") == 0);
> 
> This assertion will fail if the implementation produces an n-char-sequence 
> NaN.

It will fail if the implementation produces an n-char-sequence which is
longer than 15 bytes. Do you find this is likely? If so, feel free to bump
the number 20 to 50 or so.

Bruno





reply via email to

[Prev in Thread] Current Thread [Next in Thread]