From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Intervals crash Date: Fri, 24 Sep 2010 10:16:01 +0200 Message-ID: <83iq1vtv3y.fsf@gnu.org> References: <87aan82uar.fsf@stupidchicken.com> <83bp7ouw2u.fsf@gnu.org> <87bp7n3c19.fsf@uwakimon.sk.tsukuba.ac.jp> Reply-To: Eli Zaretskii NNTP-Posting-Host: lo.gmane.org X-Trace: dough.gmane.org 1285316239 4073 80.91.229.12 (24 Sep 2010 08:17:19 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 24 Sep 2010 08:17:19 +0000 (UTC) Cc: cyd@stupidchicken.com, emacs-devel@gnu.org To: "Stephen J. Turnbull" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Sep 24 10:17:16 2010 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.69) (envelope-from ) id 1Oz3Sy-0007dK-NS for ged-emacs-devel@m.gmane.org; Fri, 24 Sep 2010 10:17:13 +0200 Original-Received: from localhost ([127.0.0.1]:50969 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Oz3Sy-0002v6-3v for ged-emacs-devel@m.gmane.org; Fri, 24 Sep 2010 04:17:12 -0400 Original-Received: from [140.186.70.92] (port=34034 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Oz3Ro-0002Vl-0W for emacs-devel@gnu.org; Fri, 24 Sep 2010 04:16:01 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Oz3Rm-000169-Iv for emacs-devel@gnu.org; Fri, 24 Sep 2010 04:15:59 -0400 Original-Received: from mtaout23.012.net.il ([80.179.55.175]:38243) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oz3Rm-00015x-CY for emacs-devel@gnu.org; Fri, 24 Sep 2010 04:15:58 -0400 Original-Received: from conversion-daemon.a-mtaout23.012.net.il by a-mtaout23.012.net.il (HyperSendmail v2007.08) id <0L9800300RYUNQ00@a-mtaout23.012.net.il> for emacs-devel@gnu.org; Fri, 24 Sep 2010 10:15:56 +0200 (IST) Original-Received: from HOME-C4E4A596F7 ([77.127.203.3]) by a-mtaout23.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0L98003EWSAJKQ80@a-mtaout23.012.net.il>; Fri, 24 Sep 2010 10:15:56 +0200 (IST) In-reply-to: <87bp7n3c19.fsf@uwakimon.sk.tsukuba.ac.jp> X-012-Sender: halo1@inter.net.il X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) 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:130736 Archived-At: > From: "Stephen J. Turnbull" > Cc: Chong Yidong , > emacs-devel@gnu.org > Date: Fri, 24 Sep 2010 15:12:34 +0900 > > > I'd rather fix it properly. I replaced all EMACS_UINT with > > EMACS_INT in intervals.c, it couldn't be worse than int it used > > before. > > You should just do that everywhere. EMACS_UINT is a bad idea, and > should be avoided. Easier said then done, for someone such as myself, with very limited resources. I used EMACS_UINT because the related data structure used it for some of its members. I didn't have time to study the code enough to understand whether it was really needed, but the change which introduced it was deliberate, so I trusted that whoever did it had good reasons. > First, unsigned-ness tends to propagate because of C coercion rules, > which is rarely desired Funny that you should mention it, because I used EMACS_UINT precisely to avoid such problems (comparison of signed and unsigned), given that some struct members were unsigned. > The conclusion is that unsigneds (eg, size_t's) should be treated the > same way you treat legacy-encoded external text input: hazardous > material that you should convert to some sane internal type as soon as > possible, and to be produced only just before use in external APIs. > As such, there's really no need for EMACS_UINT. If you really need the full range of size_t or EMACS_UINT, there's little you can do in practice.