For the curious: Setup.exe char-> String patch

Gary R Van Sickle tiberius@braemarinc.com
Fri Feb 1 18:59:00 GMT 2002


> -----Original Message-----
> From: Robert Collins [mailto:robert.collins@itdomain.com.au]
> > -----Original Message-----
> > From: Gary R Van Sickle [mailto:tiberius@braemarinc.com]
> > 
> > I think it would behoove us greatly to duplicate the semantics of
> > std::string here, and return a zero-based offset on success, 
> > and an "npos"
> > on failure.
>  
> Whats a 'npos' defined as?
>  

"static const size_type npos = -1;"  It's a member of basic_string, so
something like this would do it:

class String
{
	static const long npos = -1;
};

and then you just have to compare to "String::npos" everywhere.

I don't know if initing to -1 is actually legal in the class declaration,
but you get the drift.

> > > geturl.cc:
> > >
> > >  static void
> > > -init_dialog (char const *url, int length, HWND owner)
> > > +init_dialog (String const url, int length, HWND owner)
> >                 ^^^^^^^^^^^^^^^^
> > 
> > This would be better written "const String &url".
> 
> Weeel, yes it would, yet another typo. Fortunately String copies are
> very lightweight :}.
> (One addition, one subtraction, and if test and 4 bytes of storage)

??? You're doing some sort of ref counting?  Isn't that a bit ambitious for
our current needs?

-- 
Gary R. Van Sickle
Braemar Inc.
11481 Rupp Dr.
Burnsville, MN 55337
-------------- next part --------------
A non-text attachment was scrubbed...
Name: winmail.dat
Type: application/ms-tnef
Size: 2376 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin-patches/attachments/20020201/a545efeb/attachment.bin>


More information about the Cygwin-patches mailing list