From owner-freebsd-hackers Tue Oct 3 16:26:30 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from ns.internet.dk (ns.internet.dk [194.19.140.1]) by hub.freebsd.org (Postfix) with ESMTP id 9C2CD37B66C for ; Tue, 3 Oct 2000 16:26:26 -0700 (PDT) Received: (from uucp@localhost) by ns.internet.dk (8.9.3/8.9.3) with UUCP id BAA90013 for hackers@FreeBSD.ORG; Wed, 4 Oct 2000 01:26:25 +0200 (CEST) (envelope-from leifn@neland.dk) Received: from gina (gina.neland.dk [192.168.0.14]) by arnold.neland.dk (8.11.0/8.11.0) with SMTP id e93LU1N04688 for ; Tue, 3 Oct 2000 23:30:02 +0200 (CEST) (envelope-from leifn@neland.dk) Message-ID: <00bf01c02d81$17f90240$0e00a8c0@neland.dk> Reply-To: "Leif Neland" From: "Leif Neland" Cc: References: <20001003144911.A12803@dan.emsphone.com> Subject: Re: Question about -Wchar-subscripts Date: Tue, 3 Oct 2000 23:26:20 +0200 X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.00.3018.1300 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.3018.1300 Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG ----- Original Message ----- From: "Dan Nelson" To: "Larry Lile" Cc: Sent: Tuesday, October 03, 2000 9:49 PM Subject: Re: Question about -Wchar-subscripts > 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. > How about unsigned char? Could that be used for index? Leif To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message