Re: E 0.9.3 release?

[email protected] (Jon Leonard)
Newsgroups gmane.comp.lang.e.general
Message-ID <[email protected]>
On Sun, Jan 02, 2011 at 04:07:59PM -0800, Mark Miller wrote:
> On Sun, Jan 2, 2011 at 11:36 AM, Bill Frantz <[email protected]> wrote:
> 
> > On 1/1/11 at 10:12 PM, [email protected] (Mark Miller) wrote:
> >
> > >* New warning: "warning: array subscript has type `char'"
> > >for C code in byacc/j that seems innocent to me. And in any case is old
> > >third party code.
> >
> > Since C supports signed chars (an abomination on the world), a C
> > compiler which actually defaults to signed could cause array
> > underflow problems. YMMV. VWP. Caveat emptor.
> >
> > I would change their declarations to include "unsigned".
> >
> 
> If I saw something that looked like indexing, I would understand. However,
> the warning complains, for example, about the last line of the following
> program fragment. This only happens to me using cygwin gcc on Windows.
> Compiling the same code on my Mac using regular gcc emits no warning.
> 
> 
> void print_pos(char *st_line,char *st_cptr)
> {
> char *s;
> 
>   if (st_line == 0) return;
>   for (s = st_line; *s != '\n'; ++s)
>     {
>          if (isprint(*s) || *s == '\t')

The problem is likely to be the implementation of isprint:  It is frequently
implemented as a (lightly protected) lookup in an array.  The warning would
likely go away if *s were declared or cast unsigned char.

Probably a bug in the isprint implementation, but still a real warning.

Jon Leonard
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.