From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 123913 invoked by alias); 19 Oct 2016 13:43:46 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 123892 invoked by uid 89); 19 Oct 2016 13:43:45 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: paperclip.tbsaunde.org Received: from tbsaunde.org (HELO paperclip.tbsaunde.org) (66.228.47.254) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 19 Oct 2016 13:43:44 +0000 Received: from ball (unknown [IPv6:2607:f0c8:8000:80e0:56ee:75ff:fe52:afb9]) by paperclip.tbsaunde.org (Postfix) with ESMTPSA id D2058C056; Wed, 19 Oct 2016 13:43:42 +0000 (UTC) Date: Wed, 19 Oct 2016 13:43:00 -0000 From: Trevor Saunders To: Pedro Alves Cc: gdb-patches@sourceware.org Subject: Re: [PATCH v2 01/31] Introduce string_printf Message-ID: <20161019135300.37ghx3zsjincxwh7@ball> References: <1476839539-8374-1-git-send-email-palves@redhat.com> <1476839539-8374-2-git-send-email-palves@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1476839539-8374-2-git-send-email-palves@redhat.com> User-Agent: NeoMutt/20161014 (1.7.1) X-SW-Source: 2016-10/txt/msg00568.txt.bz2 > +std::string > +string_printf (const char* fmt, ...) std::string is unfortunately kind of large for a return value its 4 * sizeof (void *), but maybe the simplicity matters more here. > +{ > + std::string str; > + va_list vp; > + > + /* Start by assuming some reasonable size will be sufficient. */ > + str.resize (1024); > + > + while (1) > + { > + size_t size; > + int result; you could declare these at first use right? Trev