From owner-freebsd-hackers Tue Oct 3 12:49:19 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by hub.freebsd.org (Postfix) with ESMTP id 69CB037B502 for ; Tue, 3 Oct 2000 12:49:17 -0700 (PDT) Received: (from dan@localhost) by dan.emsphone.com (8.9.3/8.9.3) id OAA18055; Tue, 3 Oct 2000 14:49:11 -0500 (CDT) (envelope-from dan) Date: Tue, 3 Oct 2000 14:49:11 -0500 From: Dan Nelson To: Larry Lile Cc: hackers@FreeBSD.ORG Subject: Re: Question about -Wchar-subscripts Message-ID: <20001003144911.A12803@dan.emsphone.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline User-Agent: Mutt/1.3.9i In-Reply-To: ; from "Larry Lile" on Tue Oct 3 15:46:36 GMT 2000 X-OS: FreeBSD 5.0-CURRENT Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG In the last episode (Oct 03), Larry Lile said: > > ...we get scores of warnings about using characters as subscripts > to an array (-Wchar-subscripts), which generates so much noise as > to mask real warnings burried within. Therefore, I would like to > suppress this warning unless someone can explain why using a char > as an array subscript is in any way an illegitimate thing to do. > As far as I can tell, getting rid of the warning by changing the > code would require adding a large number of frivolous casts to > scores of source files... > > So why is using a "char" as an array subscript wrong? I had always > avoided it because the compiler complained and that was good enough > for me. Because your char value could be negative and end up referencing memory before your array start. Mainly a problem with the ctype macros and high-ascii characters. -- Dan Nelson dnelson@emsphone.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message