This is the mail archive of the
libstdc++@sourceware.cygnus.com
mailing list for the libstdc++ project.
Re: <string> - warning messages
Hello,
I see more problems here than that.
It looks like an attempt to check validity of the range [__beg, end).
_M_replace contains similar piece of code (bits/string.tcc:424):
size_type __dist_new = static_cast<size_type>(distance(__j1, __j2));
In the case of negative distance in both cases it is converted to big
unsigned
value - in the first case by _Rep::_S_create(__range, __a) call.
If it is bigger than max_size() than length_error will be thrown,
otherwise we'll
have undefined behavior predicted in Standard.
I would like to know what is supposed to happen in such cases.
(e.g.
string s1("some text");
string s2(s1.end(), s1.begin());
)
Vadim.
"Edwards, Phil" wrote:
>
> + bits/string.tcc:119 // (__range > 0 ? __range : -1 * __range;)
> + warning: statement with no effect
> ^
> ^
> My guess is this semi right here --------------------------------------|
> inside the parens but I could easily be wrong.
>
--
*********************************************
Vadim Egorov, 1C * Вадим Егоров,1C
egorovv@1c.ru * egorovv@1c.ru
*********************************************