Mail Archives: djgpp/1998/10/09/10:16:40
From: | Charles Krug <charles AT mail DOT pentek DOT com>
|
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
|
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
|
<HTML>
Hello List!,
<P>I'm not sure if this is a problem specific to djgpp or whether this
applies to all versions of gcc2.8.1.
<P>I built something like this:<TT></TT>
<P><TT>#include <stdlib> // workaround for the c++ headers</TT>
<BR><TT>#include <string> // std string classes</TT>
<BR><TT>#include <iostream></TT><TT></TT>
<P><TT>int main()</TT>
<BR><TT>{</TT>
<BR><TT> string hexes = "0123456789abcdef";</TT>
<BR><TT> string fred "12345";</TT>
<BR><BR>
<TT> if (hexes.find(fred) == npos) // complains here
that npos is undefined</TT>
<BR><TT> cout << "I can't
find it\n";</TT><TT></TT>
<P><TT> return 0;</TT>
<BR><TT>}</TT><TT></TT>
<P>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
<P>Suggestions are welcome
<BR>
<P>Charles</HTML>
- Raw text -