From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 99951 invoked by alias); 5 Dec 2019 23:02:37 -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 99925 invoked by uid 89); 5 Dec 2019 23:02:36 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 spammy=H*i:sk:Mn7Ms1w, H*f:CAH6eHdTQey6, H*i:CAH6eHdTQey6, H*f:sk:Mn7Ms1w X-HELO: gate.crashing.org Received: from gate.crashing.org (HELO gate.crashing.org) (63.228.1.57) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 05 Dec 2019 23:02:35 +0000 Received: from gate.crashing.org (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id xB5N2TTv013886; Thu, 5 Dec 2019 17:02:30 -0600 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id xB5N2TBk013883; Thu, 5 Dec 2019 17:02:29 -0600 Date: Thu, 05 Dec 2019 23:02:00 -0000 From: Segher Boessenkool To: Jonathan Wakely Cc: Michael Matz , Thomas Schwinge , "gcc@gcc.gnu.org" , gcc-patches , "fortran@gcc.gnu.org List" Subject: Re: [RFC] Characters per line: from punch card (80) to line printer (132) (was: [Patch][OpenMP/OpenACC/Fortran] Fix mapping of optional (present|absent) arguments) Message-ID: <20191205230228.GO3152@gate.crashing.org> References: <8be82276-81b1-817c-fcd2-51f24f5fe2d2@codesourcery.com> <20191205151515.GS10088@tucnak> <87lfrq6ahm.fsf@euler.schwinge.homeip.net> <20191205200650.GI3152@gate.crashing.org> <20191205221939.GN3152@gate.crashing.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i X-IsSubscribed: yes X-SW-Source: 2019-12/txt/msg00390.txt.bz2 On Thu, Dec 05, 2019 at 10:37:33PM +0000, Jonathan Wakely wrote: > On Thu, 5 Dec 2019 at 22:19, Segher Boessenkool wrote: > > Or you could write > > > > auto __c = (__builtin_memcmp(&*__first1, &*__first2, __len) <=> 0); > > if (__c) > > return __c; > > > > which is much easier to read, to my eyes anyway. And it is exactly the > > same for the compiler. > > In this case yes, but not in general. > > Given: > > auto x = foo(); > if (bar(x)) > { } > some_type y; > > The destructor of x won't run until after y has been destroyed. That's > not at all identical to: > > if (auto x = foo(); bar(x)) > { } > some_type y; > > Please don't try to tell me how C++ works :-) I don't, I wouldn't even *know* that. But this is just the same as in C, and I do know how to write good C code. I don't think doing non-trivial things with constructors and destructors (or anything else!) implicitly is a good idea at all, but that's an altogether different subject. Segher