From owner-freebsd-arch Mon Nov 29 11:16:40 1999 Delivered-To: freebsd-arch@freebsd.org Received: from ns1.yes.no (ns1.yes.no [195.204.136.10]) by hub.freebsd.org (Postfix) with ESMTP id E152314D4A for ; Mon, 29 Nov 1999 11:16:38 -0800 (PST) (envelope-from eivind@bitbox.follo.net) Received: from bitbox.follo.net (bitbox.follo.net [195.204.143.218]) by ns1.yes.no (8.9.3/8.9.3) with ESMTP id UAA22829 for ; Mon, 29 Nov 1999 20:16:36 +0100 (CET) Received: (from eivind@localhost) by bitbox.follo.net (8.8.8/8.8.6) id UAA65572 for freebsd-arch@freebsd.org; Mon, 29 Nov 1999 20:16:36 +0100 (MET) Received: from knight.cons.org (knight.cons.org [194.233.237.195]) by hub.freebsd.org (Postfix) with ESMTP id DD4A714D4A for ; Mon, 29 Nov 1999 11:16:13 -0800 (PST) (envelope-from cracauer@knight.cons.org) Received: (from cracauer@localhost) by knight.cons.org (8.9.3/8.9.3) id UAA10019 for arch@freebsd.org; Mon, 29 Nov 1999 20:16:11 +0100 (CET) Date: Mon, 29 Nov 1999 20:16:11 +0100 From: Martin Cracauer To: arch@freebsd.org Subject: What to do about "subscript has type `char'" warnings? Message-ID: <19991129201610.A9998@cons.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.95.1i Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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 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