bug-gnulib
[Top][All Lists]
Advanced

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

Re: RFT: *printf-posix modules


From: Eric Blake
Subject: Re: RFT: *printf-posix modules
Date: Tue, 22 May 2007 13:42:23 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

Bruno Haible <bruno <at> clisp.org> writes:

> Indeed. I was seeing angle brackets instead of parentheses... Together with
> the description of strtod(), it's clear, however. Here is a fix.

Some nits:

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

> --- 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.  You may want to assert that strlen(result) == the return value of the 
printf, or that strlen(result) > minimum length, but you cannot assert that the 
result is a fixed length.  This occurs several times throughout your patch.

-- 
Eric Blake






reply via email to

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