From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Chetan Pandya Newsgroups: gmane.emacs.devel Subject: Re: signed vs unsigned char in coding.h Date: Fri, 20 Feb 2009 13:29:25 -0800 (PST) Message-ID: <911486.24447.qm@web83203.mail.mud.yahoo.com> References: <200902201619.n1KGJBtJ006483@rodan.ics.uci.edu> Reply-To: pandyacus@sbcglobal.net NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1235165391 17023 80.91.229.12 (20 Feb 2009 21:29:51 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 20 Feb 2009 21:29:51 +0000 (UTC) Cc: Kenichi Handa To: emacs-devel@gnu.org, Dan Nicolaescu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Feb 20 22:31:07 2009 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1LacxV-0001F7-Im for ged-emacs-devel@m.gmane.org; Fri, 20 Feb 2009 22:30:58 +0100 Original-Received: from localhost ([127.0.0.1]:35167 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LacwB-0001VP-6e for ged-emacs-devel@m.gmane.org; Fri, 20 Feb 2009 16:29:35 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Lacw7-0001VK-9T for emacs-devel@gnu.org; Fri, 20 Feb 2009 16:29:31 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Lacw5-0001V8-So for emacs-devel@gnu.org; Fri, 20 Feb 2009 16:29:30 -0500 Original-Received: from [199.232.76.173] (port=59748 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Lacw5-0001V5-Mm for emacs-devel@gnu.org; Fri, 20 Feb 2009 16:29:29 -0500 Original-Received: from web83203.mail.mud.yahoo.com ([216.252.101.47]:29821) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1Lacw5-0002lA-7j for emacs-devel@gnu.org; Fri, 20 Feb 2009 16:29:29 -0500 Original-Received: (qmail 25924 invoked by uid 60001); 20 Feb 2009 21:29:25 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=sbcglobal.net; h=X-YMail-OSG:Received:X-Mailer:Date:From:Reply-To:Subject:To:Cc:In-Reply-To:MIME-Version:Content-Type:Message-ID; b=1wejFB3yNTDV+BzTIBEmlBiU3EMMY2aC5P98KpLE2u50hhGWfdR/8omshlkAKArTWAe4bajFZ8Vug4Mmhxm5dUoOXBWoX9Du6BAeGTzqxrPaf4JFhXx2zkUFhq8IV3lNrgG6Bw849rW293WZjhMMM4NK/N8wHn+eTHJdmF+XnG8=; X-YMail-OSG: lPwRqQUVM1mQcJILbF1crBJWZOQEH6OBxhfJdj7VeD4E5DPzsTg8fbWqdzrLSgpJ_slIJrAbBItdHFaKh8SIE7I0pRuZ87LPN7YtUAZn4aWbVptSwvFOojV1tvR51O9zIJMTI5BjVAEIgVJ9e5Ie.f6klBdCFgmGnZyWTk0kbeXIyVTJthsGNL4VltzzCcGiX.yx4xeO.cRb Original-Received: from [76.200.183.251] by web83203.mail.mud.yahoo.com via HTTP; Fri, 20 Feb 2009 13:29:25 PST X-Mailer: YahooMailWebService/0.7.260.1 In-Reply-To: <200902201619.n1KGJBtJ006483@rodan.ics.uci.edu> X-detected-operating-system: by monty-python.gnu.org: FreeBSD 6.x (1) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:109260 Archived-At: --- On Fri, 2/20/09, Dan Nicolaescu wrote: > struct coding_system in coding.h contains this: > > char *safe_charsets; > > > and coding.c has this: > > #define SAFE_CHARSET_P(coding, id) \ > ((id) <= (coding)->max_charset_id \ > && (coding)->safe_charsets[id] >= 0) > > on some platforms "char" is unsigned by default, > so the above >=0 > comparison is always true. > > What is the intention here, should safe_charsets be defined > as "signed char" ? It looks like there are more things needed here. Since the safe_charsets is part of a string, it makes sense to declare it as unsigned char and compare it to 255. However, when in coding.c:9298 this is initialized with safe_charsets = Fmake_string (make_number (max_charset_id + 1), make_number (255)); This also has problems since it tries to create a string with a character that is not ASCII_CHAR_P. Wouldn't it make sense to create with ascii char and then replace all with 255 instead? Chetan