[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Miscellaneous code readability improvements.
From: |
Joel E. Denny |
Subject: |
Re: [PATCH] Miscellaneous code readability improvements. |
Date: |
Thu, 27 Aug 2009 13:36:19 -0400 (EDT) |
User-agent: |
Alpine 1.00 (DEB 882 2007-12-20) |
Hi Eric.
On Thu, 27 Aug 2009, Eric Blake wrote:
> Joel E. Denny <jdenny <at> clemson.edu> writes:
>
> > char const *p = yytext + 1;
> > - if (*p == ' ')
> > - p = "` '";
> > + char quoted_ws[] = "` '";
> > + if (isspace (*p) && isprint (*p))
>
> Oops. Non-portable code, since an 8-bit signed char falls outside of the
> valid
> domain of is* (cygwin's headers catch this bug, and I have a pending bug
> request asking glibc to warn in this case, too):
>
> scan-gram.l: In function `gram_lex':
> scan-gram.l:621: warning: subscript has type `char'
> scan-gram.l:621: warning: subscript has type `char'
>
> OK to apply this fix?
Thanks for catching the problem. However, I'm a little confused. My
isspace man page says the argument is of type int. It also says:
These functions check whether c, which must have the value of an
unsigned char or EOF, falls into a certain character class according to
the current locale.
Isn't EOF usually -1? What type includes -1 and doesn't include signed
char?
> From: Eric Blake <address@hidden>
> Date: Thu, 27 Aug 2009 10:56:53 -0600
> Subject: [PATCH] scan-gram: avoid portability trap with ctype usage.
>
> * src/scan-gram.l (splice): Avoid compiler warning.
I would say the correct top-level construct is
<SC_ESCAPED_STRING,SC_ESCAPED_CHARACTER> rather than splice. git doesn't
know how to read Flex specifications.
- Re: [PATCH] Miscellaneous code readability improvements., (continued)
- Re: [PATCH] Miscellaneous code readability improvements., Akim Demaille, 2009/08/13
- Re: [PATCH] Miscellaneous code readability improvements., Joel E. Denny, 2009/08/13
- Re: [PATCH] Miscellaneous code readability improvements., Akim Demaille, 2009/08/13
- Re: [PATCH] Miscellaneous code readability improvements., Akim Demaille, 2009/08/14
- Re: [PATCH] Miscellaneous code readability improvements., Joel E. Denny, 2009/08/18
- Re: [PATCH] Miscellaneous code readability improvements., Joel E. Denny, 2009/08/19
- Re: [PATCH] Miscellaneous code readability improvements., Akim Demaille, 2009/08/19
- Re: [PATCH] Miscellaneous code readability improvements., Joel E. Denny, 2009/08/19
- Re: [PATCH] Miscellaneous code readability improvements., Joel E. Denny, 2009/08/21
- Re: [PATCH] Miscellaneous code readability improvements., Eric Blake, 2009/08/27
- Re: [PATCH] Miscellaneous code readability improvements.,
Joel E. Denny <=
- Re: [PATCH] Miscellaneous code readability improvements., Eric Blake, 2009/08/27
- Re: [PATCH] Miscellaneous code readability improvements., Joel E. Denny, 2009/08/27
- Re: [PATCH] Miscellaneous code readability improvements., Eric Blake, 2009/08/27
- Re: [PATCH] Miscellaneous code readability improvements., Joel E. Denny, 2009/08/28
- Re: [PATCH] Miscellaneous code readability improvements., Eric Blake, 2009/08/28
- Re: [PATCH] Miscellaneous code readability improvements., Joel E. Denny, 2009/08/29