From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Barry Margolin Newsgroups: gmane.emacs.help Subject: Re: string-match bug? Date: Wed, 09 Dec 2009 19:22:46 -0500 Organization: A noiseless patient Spider Message-ID: References: <4B1D6773.3000509@easy-emacs.de> <4B1F5A38.1030703@easy-emacs.de> <4B1FDF51.1010002@easy-emacs.de> NNTP-Posting-Host: lo.gmane.org X-Trace: ger.gmane.org 1260405705 23197 80.91.229.12 (10 Dec 2009 00:41:45 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 10 Dec 2009 00:41:45 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Dec 10 01:41:38 2009 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1NIX69-0007Fr-Us for geh-help-gnu-emacs@m.gmane.org; Thu, 10 Dec 2009 01:41:38 +0100 Original-Received: from localhost ([127.0.0.1]:36038 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NIX69-0001kQ-R2 for geh-help-gnu-emacs@m.gmane.org; Wed, 09 Dec 2009 19:41:37 -0500 Original-Path: news.stanford.edu!usenet.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsfeed.straub-nv.de!feeder.eternal-september.org!eternal-september.org!news.eternal-september.org!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 26 Original-X-Trace: news.eternal-september.org U2FsdGVkX1+NweDmOmY+wXkwvNEz2GF7dMVGwGkEzpvafLPt3CnrgmrzbDafMZgMUF7gI2HJOsYbITA7a+CoGaGfEPs7PjgtlTIzDI8iqovndXCpz/XTEqYcP5dtLEZwhcQNiOtF5s8= Original-X-Complaints-To: abuse@eternal-september.org Original-NNTP-Posting-Date: Thu, 10 Dec 2009 00:22:46 +0000 (UTC) User-Agent: MT-NewsWatcher/3.5.3b3 (Intel Mac OS X) X-Auth-Sender: U2FsdGVkX1/5D3zZROiEQBUq/b480MwqT80our43TDs= Cancel-Lock: sha1:zZTHVPIA3O/QSGipxRe+zZ04GrU= Original-Xref: news.stanford.edu gnu.emacs.help:175467 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:70540 Archived-At: In article , Andreas Röhler wrote: > Matthew Dempsky wrote: > > On Wed, Dec 9, 2009 at 9:33 AM, Andreas Röhler > > wrote: > >> But simply by convention, isn't it? > > > > No. It's because it's consistent and makes sense. That's why every > > sane programming language does it this way: > > > > C: s = "foo", strstr(s, "") evaluates to s > > > CMIIW but does this example above not mean, it returns > the string? So far quite different from the rest? Not really. It's just that strstr() reports a successful match by returning a pointer to the first character of the match; the other functions return the position. They're isomorphic. -- Barry Margolin, barmar@alum.mit.edu Arlington, MA *** PLEASE post questions in newsgroups, not directly to me *** *** PLEASE don't copy me on replies, I'll read them in the group ***