From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15565 invoked by alias); 19 Oct 2016 17:40:51 -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 15556 invoked by uid 89); 19 Oct 2016 17:40:50 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.7 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_LOW,RCVD_IN_SEMBACKSCATTER autolearn=no version=3.3.2 spammy=phil, Hx-languages-length:1802 X-HELO: mx0a-001b2d01.pphosted.com Received: from mx0a-001b2d01.pphosted.com (HELO mx0a-001b2d01.pphosted.com) (148.163.156.1) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 19 Oct 2016 17:40:49 +0000 Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.17/8.16.0.17) with SMTP id u9JHcoNP026106 for ; Wed, 19 Oct 2016 13:40:47 -0400 Received: from e06smtp07.uk.ibm.com (e06smtp07.uk.ibm.com [195.75.94.103]) by mx0a-001b2d01.pphosted.com with ESMTP id 266a6mukwq-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Wed, 19 Oct 2016 13:40:47 -0400 Received: from localhost by e06smtp07.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 19 Oct 2016 18:39:14 +0100 Received: from d06dlp03.portsmouth.uk.ibm.com (9.149.20.15) by e06smtp07.uk.ibm.com (192.168.101.137) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 19 Oct 2016 18:39:12 +0100 Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by d06dlp03.portsmouth.uk.ibm.com (Postfix) with ESMTP id 58D4C1B08067 for ; Wed, 19 Oct 2016 18:41:15 +0100 (BST) Received: from d06av11.portsmouth.uk.ibm.com (d06av11.portsmouth.uk.ibm.com [9.149.37.252]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u9JHdBFX23265294 for ; Wed, 19 Oct 2016 17:39:11 GMT Received: from d06av11.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av11.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id u9JHdBSN016344 for ; Wed, 19 Oct 2016 11:39:11 -0600 Received: from ThinkPad (dyn-9-152-212-68.boeblingen.de.ibm.com [9.152.212.68]) by d06av11.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id u9JHdBNm016341; Wed, 19 Oct 2016 11:39:11 -0600 Date: Wed, 19 Oct 2016 17:40:00 -0000 From: Philipp Rudo To: Pedro Alves , gdb-patches@sourceware.org Subject: Re: [PATCH v2 31/31] Support an "unlimited" number of user-defined arguments In-Reply-To: <35a899f9-9014-3b1f-8b12-e807ed290caa@redhat.com> References: <1476839539-8374-1-git-send-email-palves@redhat.com> <1476839539-8374-32-git-send-email-palves@redhat.com> <20161019133349.2bc6ccf2@ThinkPad> <35a899f9-9014-3b1f-8b12-e807ed290caa@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16101917-0028-0000-0000-00000233F4E4 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16101917-0029-0000-0000-000020DEA08A Message-Id: <20161019193927.09aebd85@ThinkPad> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-10-19_14:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1609300000 definitions=main-1610190314 X-IsSubscribed: yes X-SW-Source: 2016-10/txt/msg00576.txt.bz2 On Wed, 19 Oct 2016 13:47:22 +0100 Pedro Alves wrote: > On 10/19/2016 12:33 PM, Philipp Rudo wrote: > > Pedro Alves wrote: > > >> I also needed a way to convert a number to a std::string, so I added a > >> new utility for that, gdb::to_string. Yet another thing that can go > >> away with C++11. > > [... snip ...] > >> +/* Returns a string representation of VAL. Replacement for > >> + std::to_string, which is only available in C++11 or later. */ > >> + > >> +namespace gdb { > >> + > >> +template > >> +inline std::string > >> +to_string (const T &val) > >> +{ > >> + std::stringstream ss; > >> + > >> + ss << val; > >> + return ss.str (); > >> +} > >> + > >> +} > >> + > >> /* Make a copy of the string at PTR with LEN characters > >> (and add a null character at the end in the copy). > >> Uses malloc to get the space. Returns the address of the copy. */ > > > > Is this really necessary? > > As far as I understood the discussion, we jump directly to C++11. Thus there is no need for an homemade to_string. > > We haven't actually officially committed to requiring > C++11, so I didn't want to be blocked by that. It's > trivial to remove that bit latter if this lands first. True that C++11 is not official yet. But the "trivial to remove" is exactly the reason I wrote, as those pieces of code tend to stay in the longest. And in 10+ years nobody knows why there is such a messy mix of different functions doing the same thing and why it hasn't been done right in the first place ;) So my mail should not push you to use std::to_string but be seen as a reminder, that if we require C++11 your home made function should be deleted better sooner than later. Phil