[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: string-match bug?

From: Barry Margolin
Subject: Re: string-match bug?
Date: Wed, 09 Dec 2009 19:22:46 -0500
User-agent: MT-NewsWatcher/3.5.3b3 (Intel Mac OS X)

In article <address@hidden>,
 Andreas Röhler <address@hidden> wrote:

> Matthew Dempsky wrote:
> > On Wed, Dec 9, 2009 at 9:33 AM, Andreas Röhler
> > <address@hidden> 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, address@hidden
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 ***

reply via email to

[Prev in Thread] Current Thread [Next in Thread]