From owner-freebsd-hackers Tue Oct 3 13:13:24 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from smtp1.vnet.net (smtp1.vnet.net [166.82.1.31]) by hub.freebsd.org (Postfix) with ESMTP id E2E2237B502 for ; Tue, 3 Oct 2000 13:13:22 -0700 (PDT) Received: from dignus.com (ponds.vnet.net [166.82.177.48]) by smtp1.vnet.net (8.10.1/8.10.1) with ESMTP id e93KDFF23441; Tue, 3 Oct 2000 16:13:16 -0400 (EDT) Received: from lakes.dignus.com (lakes.dignus.com [10.0.0.3]) by dignus.com (8.9.2/8.8.5) with ESMTP id QAA40800; Tue, 3 Oct 2000 16:13:14 -0400 (EDT) Received: (from rivers@localhost) by lakes.dignus.com (8.9.3/8.6.9) id QAA81703; Tue, 3 Oct 2000 16:13:14 -0400 (EDT) Date: Tue, 3 Oct 2000 16:13:14 -0400 (EDT) From: Thomas David Rivers Message-Id: <200010032013.QAA81703@lakes.dignus.com> To: dnelson@emsphone.com, lile@stdio.com Subject: Re: Question about -Wchar-subscripts Cc: hackers@FreeBSD.ORG In-Reply-To: <20001003144911.A12803@dan.emsphone.com> 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. > That's an interesting reason... any variable can be negative (well, except for the unsigned types...) - what's so interesting about `char'? Is it simply ctype macros that are the concern, or something "bigger"? - Dave R. - To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message