public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jonathan Wakely <jwakely@redhat.com>
To: cauldwell.thomas@gmail.com
Cc: "libstdc++" <libstdc++@gcc.gnu.org>
Subject: Re: string::iterator should have more error checking
Date: Thu, 23 Jun 2022 23:35:51 +0100	[thread overview]
Message-ID: <CACb0b4no6kZcS6F1b+k2eH_FznL8x4yJdBXr+HdkyYs74NG7Nw@mail.gmail.com> (raw)
In-Reply-To: <CALtZhhO0cAuCoy19qDFxUYW8yccQRWW1hPCi5vXRMWt74Yiiew@mail.gmail.com>

On Thu, 23 Jun 2022 at 23:01, Frederick Virchanza Gotham via Libstdc++
<libstdc++@gcc.gnu.org> wrote:
>
> 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.

Yes it does:
https://godbolt.org/z/hYhcfjTWY



>
> 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?

Yes, for full Debug Mode checks you need to use __gnu_debug::string,
as documented in the manual.


  reply	other threads:[~2022-06-23 22:36 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-23 21:05 Frederick Virchanza Gotham
2022-06-23 21:26 ` Jonathan Wakely
2022-06-23 22:01   ` Frederick Virchanza Gotham
2022-06-23 22:35     ` Jonathan Wakely [this message]
2022-06-24  9:06       ` Frederick Virchanza Gotham
2022-06-24  9:35         ` Jonathan Wakely
2022-06-24 10:10           ` Frederick Virchanza Gotham
2022-06-24 10:28             ` Jonathan Wakely
2022-06-24 11:14               ` Frederick Virchanza Gotham

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CACb0b4no6kZcS6F1b+k2eH_FznL8x4yJdBXr+HdkyYs74NG7Nw@mail.gmail.com \
    --to=jwakely@redhat.com \
    --cc=cauldwell.thomas@gmail.com \
    --cc=libstdc++@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).