This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Simple observations (mostly docs-related) about string vs debug-mode


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]