From: Charles Krug Newsgroups: comp.os.msdos.djgpp Subject: c++ std::string--npos seems to be broken Date: Fri, 09 Oct 1998 09:32:23 -0400 Organization: Pentek Corporation Lines: 36 Message-ID: <361E1066.75DD4CE7@mail.pentek.com> NNTP-Posting-Host: mail.pentek.com Mime-Version: 1.0 Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 4.04 [en] (WinNT; I) To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Hello List!,

I'm not sure if this is a problem specific to djgpp or whether this applies to all versions of gcc2.8.1.

I built something like this:

#include <stdlib> // workaround for the c++ headers
#include <string> // std string classes
#include <iostream>

int main()
{
    string hexes = "0123456789abcdef";
    string fred "12345";

    if (hexes.find(fred) == npos) // complains here that npos is undefined
        cout << "I can't find it\n";

    return 0;
}

I'm not sure if I'm missing some kind of scope resolution or what.  npos is defined, either in string or in bastring, I forget which, but it IS defined as part of string, in a file that I've included.  It's easy enough to use "< 0" instead of npos, but I'd rather do almost anything than try to feed the compiler magic numbers just to make it happy

Suggestions are welcome
 

Charles