This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
libstdc++/9897: string.reserve/capacity does not work
- From: david at wmol dot com
- To: gcc-gnats at gcc dot gnu dot org
- Date: 1 Mar 2003 13:15:09 -0000
- Subject: libstdc++/9897: string.reserve/capacity does not work
- Reply-to: david at wmol dot com
>Number: 9897
>Category: libstdc++
>Synopsis: string.reserve/capacity does not work
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sat Mar 01 13:16:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator: David Hill
>Release: 2.95.3
>Organization:
>Environment:
OpenBSD 3.3 i386
>Description:
//
// START OF SOURCE
//
#include <iostream>
#include <string>
int main(void)
{
string test("david");
string bad;
bad.reserve(500);
cout << "bad capacity: " << bad.capacity() << endl;
cout << "test capacity before: " << test.capacity() << endl;
test.reserve(500);
cout << "test capacity after: " << test.capacity() << endl;
return 0;
}
// END OF SOURCE
this code prints
bad capacity: 0
test capacity before: 16
test capacity after: 16
shouldn't the "test capacity after" be 500?
>How-To-Repeat:
compile the code and execute.
>Fix:
unknown
>Release-Note:
>Audit-Trail:
>Unformatted: