Re: Bug in UStr find and Replace

Guy Rouillier <[email protected]> Fri, 10 Mar 2006 14:39:36 -0500
Newsgroups gmane.comp.version-control.cvs.gui.devel
Message-ID <[email protected]>
Jens Miltner wrote:
>> Changing the not-found value to -1 (minus one) fixes it for me, but I
>> have no idea what this breaks in other parts of the code.  Of course,
>> any code depending on this behavior is by definition broken itself.
> 
> Searching for 'find' in the sources should reveal usage, so we should  
> be able to verify the behavior.

So the theory goes ;).  "Replace" is feasible, since the use of that 
word with a capital "R" is limited.  Unfortunately, "find" is used in 
many other contexts, so grepping on "find" produces a large number of hits.

> While you're at it, why not define a constant for 'not found' - that  
> way, the behavior is clearer from the source code as well.

I like the idea of using a constant.  Would you suggest defining it 
within UStr itself, so that to use it from outside the class you would 
say something like UStr::NOT_FOUND?

-- 
Guy Rouillier


 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/cvsgui-dev/

<*> To unsubscribe from this group, send an email to:
    [email protected]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/