string::iterator should have more error checking

Frederick Virchanza Gotham cauldwell.thomas@gmail.com
Thu Jun 23 22:01:09 GMT 2022


On Thu, Jun 23, 2022 at 10:26 PM Jonathan Wakely <jwakely@redhat.com> wrote:

> AddressSanitizer does give an error for your example though.


If you're talking about using "g++" with the command line option
"-fsanitize=address", well I've tested it and it **doesn't** give an
error for my sample program.

I thought that "-D_GLIBCXX_DEBUG" would make it use
"__gnu_debug::string". So are you saying that I'll have to do the
following in my code?

#ifdef NDEBUG
    #include <string>
    typedef std::string string;
#else
    #include <debug/string>
    typedef __gnu_debug::string string;
#endif

Is this what I'm supposed to do?


More information about the Libstdc++ mailing list