This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: Simple observations (mostly docs-related) about string vs debug-mode
- From: Jonathan Wakely <cow at compsoc dot man dot ac dot uk>
- To: Paolo Carlini <pcarlini at suse dot de>
- Cc: libstdc++ <libstdc++ at gcc dot gnu dot org>
- Date: Mon, 23 May 2005 11:24:23 +0100
- Subject: Re: Simple observations (mostly docs-related) about string vs debug-mode
- References: <428F95D9.5010703@suse.de> <428F9A38.4050508@suse.de>
On Sat, May 21, 2005 at 10:29:44PM +0200, Paolo Carlini wrote:
> Paolo Carlini wrote:
>
> >Jonathan, are you willing to take a stab at the above (assuming you
> >agree with the ideas ;) ??
Hi Paolo,
For some reason I didn't get your original message, so I'll reply to
this one.
>> 1- It suffices to add -O1 to the command line to have the assertions
>> triggered, due to inlining, of course. This is no small thing, in my
>> opinion.
This doesn't work if the string::operator[] call is deep inside a series
of inlinable functions. If you hit the inline limit then the op[] call
will not be inlined.
This triggers the assertion at -O1, unless you add -finline-limit=5
#define _GLIBCXX_DEBUG
#include <string>
inline void f(int i)
{
if (i > 10)
{
std::string s;
s[1];
return;
}
f(++i);
}
int main()
{
f(0);
}
> Well, actually the original message
>
> http://gcc.gnu.org/ml/libstdc++/2005-05/msg00192.html
>
> Already contains in a complete form the code bits ;) I'm going to have a
> closer look and then I will probably commit soon. Thanks!
Yes, I think that patch is right, no further changes needed. I'll take care
of the docs changes (I haven't committed the last change to debug,html yet)
jon
--
"The future is here. It's just not evenly distributed yet."
- William Gibson