Ok, string::at() is supposed to throw std::out_of_range, right?

string a("a");
a.at(2);

That throws, however,

string a("a");
a.at(std::string::npos)

That will not throw.

Is this a problem, or something I'm not understanding too?

On 11/13/06, Daniel Dilts <[EMAIL PROTECTED]> wrote:

First bug:
#include <string>

int main()
{
    std::string a();
    a="alskdfjasdj";
    return 0;
}

output:
test.cpp: In function int main():
test.cpp:6: error: assignment of function std::string a()
test.cpp:6: error: cannot convert const char [12] to std::string ()() in
assignment

#include <string>

int main()
{
    std::string a("");
    a="alskdfjasdj";
    return 0;
}

This compiles.

The bug is that std::string a() and std::string a("") should have EXACTLY
the same result.  The assignment of the C-string should work in both cases.


Second bug:
Can't reproduce it in a small situation.  I wasn't getting string::at() to
throw an exception, but now it is.


On 11/13/06, Michael Torrie < [EMAIL PROTECTED]> wrote:
>
> On Mon, 2006-11-13 at 20:43 -0700, Daniel Dilts wrote:
> > I believe that I have found 2 bugs in the standard library in Fedora
> 5.
> > Does anyone know where the development site is for this version of the
> > standard libraries?
>
> Report these bugs to Fedora first ( http://bugzilla.redhat.com), and
> then
> probably to the Gnu GCC project (http://gcc.gnu.org/bugs.html ).  The
> Fedora standard c++ library is part of the GCC system.  There is also a
> Gnu libstdc++ mailing list you can post to.  See the gcc.gnu.org site
> for details.
>
> Michael
>
> > --------------------
> > BYU Unix Users Group
> > http://uug.byu.edu/
> >
> > The opinions expressed in this message are the responsibility of their
> > author.  They are not endorsed by BYU, the BYU CS Department or
> BYU-UUG.
> > ___________________________________________________________________
> > List Info: http://uug.byu.edu/cgi-bin/mailman/listinfo/uug-list
> >
>
>
> --------------------
> BYU Unix Users Group
> http://uug.byu.edu/
>
> The opinions expressed in this message are the responsibility of their
> author.  They are not endorsed by BYU, the BYU CS Department or BYU-UUG.
> ___________________________________________________________________
> List Info: http://uug.byu.edu/cgi-bin/mailman/listinfo/uug-list
>


--------------------
BYU Unix Users Group http://uug.byu.edu/
The opinions expressed in this message are the responsibility of their
author. They are not endorsed by BYU, the BYU CS Department or BYU-UUG. ___________________________________________________________________
List Info: http://uug.byu.edu/cgi-bin/mailman/listinfo/uug-list

Reply via email to