From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32956 invoked by alias); 17 Aug 2017 14:48:38 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Received: (qmail 29919 invoked by uid 89); 17 Aug 2017 14:48:36 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx1.redhat.com DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 24A69800A8 Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=palves@redhat.com Subject: Re: [PATCH 08/18] malloc: Add specialized dynarray for C strings To: Florian Weimer , Adhemerval Zanella , libc-alpha@sourceware.org References: <1502463044-4042-1-git-send-email-adhemerval.zanella@linaro.org> <1502463044-4042-9-git-send-email-adhemerval.zanella@linaro.org> From: Pedro Alves Message-ID: <90725a35-403d-7c8c-40c1-573c4d5107cd@redhat.com> Date: Thu, 17 Aug 2017 14:48:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2017-08/txt/msg00779.txt.bz2 On 08/17/2017 11:12 AM, Florian Weimer wrote: > There is a lot of complexity in this code to maintain the invariant that > the stored array is NUL-terminated. It also means that the dynarray > functions must not be used directly. > > std::string in C++ has a c_str() method which adds the null termination > on demand. Depends on what you mean by C++. std::string::c_str() must not throw and must be constant time since C++11. Thanks, Pedro Alves