libstdc++/9897: string.reserve/capacity does not work
david@wmol.com
david@wmol.com
Sat Mar 1 13:16:00 GMT 2003
>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:
More information about the Gcc-bugs
mailing list