Date: Mon, 29 Nov 1999 20:16:11 +0100 From: Martin Cracauer <cracauer@cons.org> To: arch@freebsd.org Subject: What to do about "subscript has type `char'" warnings? Message-ID: <19991129201610.A9998@cons.org>
next in thread | raw e-mail | index | archive | help
Newest compiler now produces a lot of "subscript has type `char'" warnings for sh (its syntax table). I would change direct appearences of char bla; string[bla]; to int bla; string[bla]; which IMHO is consistent with ANSI C and its int and char properties. A different matter is an index that is a followed pointer to a char; char *s = syntax[2]; string[*s]; I could either a) use an additional int variable, which causes some overhead, of course b) or cast char *s = syntax[2]; string[(int)*s]; I tend to cast for the second case, although it's a little inconsistent with the fix for the direct case. Opinions? Martin -- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Martin Cracauer <cracauer@cons.org> http://www.cons.org/cracauer/ Tel.: (private) +4940 5221829 Fax.: (private) +4940 5228536 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19991129201610.A9998>