delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/10/31/09:00:15

From: dontmailme AT iname DOT com (Steamer)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: compare()
Date: Tue, 31 Oct 2000 13:45:17 GMT
Organization: always disorganized
Lines: 46
Message-ID: <39fecce1.18547083@news.freeserve.net>
References: <1F7509A3BB20243A DOT 7FD3AC2DC483DD04 DOT 6BB6DE9721314E90 AT lp DOT airnews DOT net> <39fea8f5 DOT 9349153 AT news DOT freeserve DOT net> <2D3CEFEF9F5772C9 DOT 21D15067E7ACE130 DOT 3275BE6B77FD834E AT lp DOT airnews DOT net>
NNTP-Posting-Host: modem-5.texas.dialup.pol.co.uk
X-Trace: newsg3.svr.pol.co.uk 972999918 30608 62.137.94.5 (31 Oct 2000 13:45:18 GMT)
NNTP-Posting-Date: 31 Oct 2000 13:45:18 GMT
X-Complaints-To: abuse AT theplanet DOT net
X-Newsreader: Forte Free Agent 1.11/32.235
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Rodeo Red wrote:

> > The compare() member functions for std::string in GCC's C++ library
> > are non-standard.  
> 
> What exactly does that mean ? 
> 
> I'd guess you are saying that compare() is a standard C++ library
> function, except GCC doesn't include all the standard variations, such
> as :
> int compare(size_type pos1, size_type n1, const basic_string& str)
> const; 
> but includes other versions, which arent standard, such as:
> int compare(const basic_string& str, size_type n1,)  

That's right.  The standard forms are these:

int compare(const basic_string& str) const;
int compare(size_type pos1, size_type n1, const basic_string& str) const;
int compare(size_type pos1, size_type n1, const basic_string& str, size_type pos2, size_type n2)
const;
int compare(const charT* s) const;
int compare(size_type pos1, size_type n1, const charT* s, size_type n2 = npos) const;

The current version of GCC's C++ library is missing some of these,
but has others with the arguments in a different order.  (I've no
idea why this is.)

> > The code that Stan Moore posted obviously won't work with most C++
> > compilers.
> 
> 
> Well its not so obvious to me.:)
> Let me see if I got this straight
> He's using this  form of compare:  
> if (( pos3 > 0 ) && (word.compare(ies, pos3)))  
> 
> which would match:
> int compare(const basic_string& str, size_type n1,)  
> 
> Which does not match any compare() function in standard c++ but is
> included with djgpp. 
> 
> Correct ? 

Correct.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019