From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30773 invoked by alias); 13 Nov 2013 08:01:49 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 30763 invoked by uid 89); 13 Nov 2013 08:01:49 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL,BAYES_50,RDNS_NONE,SPF_HELO_PASS,SPF_PASS,URIBL_BLOCKED autolearn=no version=3.3.2 X-HELO: mx1.redhat.com Received: from Unknown (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 13 Nov 2013 08:01:47 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id rAD81ep7025378 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 13 Nov 2013 03:01:40 -0500 Received: from localhost (ovpn-113-88.phx2.redhat.com [10.3.113.88]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id rAD81cdm024349 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 13 Nov 2013 03:01:39 -0500 Received: by localhost (Postfix, from userid 1000) id B930F16503A; Wed, 13 Nov 2013 09:01:37 +0100 (CET) From: Dodji Seketeli To: Bernd Edlinger Cc: Jakub Jelinek , GCC Patches , Tom Tromey , Manuel =?utf-8?B?TMOzcGV6LUliw6HDsWV6?= Subject: Re: [PATCH] preprocessor/58580 - preprocessor goes OOM with warning for zero literals References: <20131031144309.GR27813@tucnak.zalov.cz> <87y559xz7y.fsf@redhat.com> <20131031173649.GW27813@tucnak.zalov.cz> <87zjpbb5qu.fsf@redhat.com> <20131111142159.GZ27813@tucnak.zalov.cz> <878uwuap4f.fsf@redhat.com> <878uwt63e2.fsf@redhat.com> <877gcc4vzs.fsf@redhat.com> X-URL: http://www.redhat.com Date: Wed, 13 Nov 2013 09:49:00 -0000 In-Reply-To: (Bernd Edlinger's message of "Wed, 13 Nov 2013 08:34:04 +0100") Message-ID: <87vbzw3f32.fsf@redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-SW-Source: 2013-11/txt/msg01406.txt.bz2 Bernd Edlinger writes: >>> Using -- on a value that goes out of scope looks >>> awkward IMHO. >> >> I don't understand this sentence. What do you mean by "Using -- on a >> value that goes out of scope"? >> > > I meant the operator --=C2=A0 in=C2=A0 *line_len =3D --len; Sorry, I don't see how that is an issue. This looks like a classical way of passing an output parameter to me. > Maybe, You could also avoid the copying completely, if you just hand out > a pointer to the line buffer as const char*, and use the length instead o= f the > nul-char as end delimiter ? I thought about avoiding the copying of course. But the issue with that is that that ties the lifetime of the returned line to the time between two invocations of read_next_line. IOW, you'd have to use the line "quickly" before calling read_next_line again. Actually that non-copying API that you are talking about exists in the patch; it's get_next_line. And you see that it's what we use when we want to avoid the copying, e.g, in goto_next_line. But when we want to give the "final" user the string, I believe that copying is less surprising. And from what I could see from the tests I have done, the copying doesn't make the thing slower than without the patch. So I'd like to keep this unless folks have very strong feeling about it. --=20 Dodji