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: Issue: compare-strings Date: Wed, 23 Dec 2009 06:11:16 +0200 Message-ID: <83k4we5nyz.fsf@gnu.org> References: <873a33fmd8.fsf@harnisch.dyndns.org> <87skb2qs9k.fsf@uwakimon.sk.tsukuba.ac.jp> Reply-To: Eli Zaretskii NNTP-Posting-Host: lo.gmane.org X-Trace: ger.gmane.org 1261541424 25272 80.91.229.12 (23 Dec 2009 04:10:24 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 23 Dec 2009 04:10:24 +0000 (UTC) Cc: emacs-devel@gnu.org To: "Stephen J. Turnbull" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Dec 23 05:10:17 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 1NNIYC-00060Q-Ge for ged-emacs-devel@m.gmane.org; Wed, 23 Dec 2009 05:10:16 +0100 Original-Received: from localhost ([127.0.0.1]:33292 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NNIYC-0005tT-AI for ged-emacs-devel@m.gmane.org; Tue, 22 Dec 2009 23:10:16 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NNIY5-0005r2-TA for emacs-devel@gnu.org; Tue, 22 Dec 2009 23:10:09 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NNIY1-0005kd-Ch for emacs-devel@gnu.org; Tue, 22 Dec 2009 23:10:09 -0500 Original-Received: from [199.232.76.173] (port=51289 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NNIY1-0005kS-5J for emacs-devel@gnu.org; Tue, 22 Dec 2009 23:10:05 -0500 Original-Received: from mtaout22.012.net.il ([80.179.55.172]:45212) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NNIY0-00050z-Kj for emacs-devel@gnu.org; Tue, 22 Dec 2009 23:10:04 -0500 Original-Received: from conversion-daemon.a-mtaout22.012.net.il by a-mtaout22.012.net.il (HyperSendmail v2007.08) id <0KV3005007H9EU00@a-mtaout22.012.net.il> for emacs-devel@gnu.org; Wed, 23 Dec 2009 06:09:01 +0200 (IST) Original-Received: from HOME-C4E4A596F7 ([87.70.160.137]) by a-mtaout22.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0KV3001P57J05TI0@a-mtaout22.012.net.il>; Wed, 23 Dec 2009 06:09:01 +0200 (IST) In-reply-to: <87skb2qs9k.fsf@uwakimon.sk.tsukuba.ac.jp> X-012-Sender: halo1@inter.net.il X-detected-operating-system: by monty-python.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:118784 Archived-At: > From: "Stephen J. Turnbull" > Date: Wed, 23 Dec 2009 12:32:55 +0900 > > We have the following report on xemacs-beta. I would like a > clarification as to the intended behavior of `compare-strings' for > arguments out of range. The behavior of Emacs makes more sense to me. > It seems silly to force users to check length of variable strings to > avoid errors in cases like > > (compare-strings "the other string is too short" "the" 0 9 0 9) > > Marcus Harnisch writes: > > > `compare-strings', a primitive added in 21.5.9 mainly for GNU > > compatibility as far as the ChangeLog says, is *not* compatible to the > > same function in Emacs 22.2.1 (Ubuntu 9.10 version). Not sure if they > > changed `compare-strings's behavior since we added it. > > > > We create an args out of range error when the positions don't seem to > > make sense (e.g. END is beyond length of the string) -- GNU doesn't. > > > > In any case, the behavior in such cases is not specified. It's quite clear from the Emacs implementation that the behavior is intentional: end1_char = SCHARS (str1); if (! NILP (end1) && end1_char > XINT (end1)) end1_char = XINT (end1); end2_char = SCHARS (str2); if (! NILP (end2) && end2_char > XINT (end2)) end2_char = XINT (end2); According to "cvs annotate", this code did not change since April 1998, when this function was introduced.