From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 0572E385021E for ; Thu, 23 Jun 2022 22:36:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 0572E385021E Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-296-VUNzT2NBOuKDxc9Jh3DdDQ-1; Thu, 23 Jun 2022 18:36:03 -0400 X-MC-Unique: VUNzT2NBOuKDxc9Jh3DdDQ-1 Received: by mail-ed1-f69.google.com with SMTP id y5-20020a056402358500b0043592ac3961so476844edc.6 for ; Thu, 23 Jun 2022 15:36:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=0NFOx5svaHWWpXAKpjPbfOIX3FZBCxs3VZNOCeRUngE=; b=nfqbMvBZtnE3xCOZcP/T7PaUtb+kDAG/gkwM18c4aZOCXdHh3gziRYPrx55FNDSRaj Z28mRZimgkyu3idQ/AIrEDr9y36m+koB22nlURlBlW3IZEMG5uocTndEQ3QO8YAtJeYr CLulnBI/dr8AVcjFG7Ag1oFiR5v+bIS+5JApy289e+6KpNt5JK9qMSKvCoT2sNHHMhJt /nuFytev1Ce0UhGGZanihxt7iqbN7hKXLU3QLxvQSwfUdbhd8/jyDJndDgD1U6ZDuqmp hOpaUwr0JqZeEYe8X20wSLKTREh0ztql/oBmJVvU0tJ7Yj0Fuqzkf5rTRPiXHRfnp420 kV+g== X-Gm-Message-State: AJIora8BAaUPzPc68brCHdJtIXM5CYjiOHeb2NCCcye4xZJct1b1D8eS e6OyCLVsK1viw0MAAP2SRcdtN082IjX218N56y7P2Zyc/thhmY5eA0+hlAjB0+eVhbTnZqjDJ/O UB5nZnbYwlTFXifPY2tLAm+EWVC+tkNk= X-Received: by 2002:a17:907:6294:b0:6e1:ea4:74a3 with SMTP id nd20-20020a170907629400b006e10ea474a3mr10335903ejc.168.1656023762200; Thu, 23 Jun 2022 15:36:02 -0700 (PDT) X-Google-Smtp-Source: AGRyM1v83J5OjjF/8klgXErt53EKXwr+TgXMyAdyYVZ3dl8qeahie64eyN7Owh2oQyQ9idDmYjAfMh9ydVsrSKNfqxg= X-Received: by 2002:a17:907:6294:b0:6e1:ea4:74a3 with SMTP id nd20-20020a170907629400b006e10ea474a3mr10335889ejc.168.1656023761979; Thu, 23 Jun 2022 15:36:01 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Jonathan Wakely Date: Thu, 23 Jun 2022 23:35:51 +0100 Message-ID: Subject: Re: string::iterator should have more error checking To: cauldwell.thomas@gmail.com Cc: "libstdc++" X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-7.9 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libstdc++@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++ mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jun 2022 22:36:07 -0000 On Thu, 23 Jun 2022 at 23:01, Frederick Virchanza Gotham via Libstdc++ wrote: > > On Thu, Jun 23, 2022 at 10:26 PM Jonathan Wakely 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 > typedef std::string string; > #else > #include > 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.