From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id zoSKC2AXqmG4fAAAWB0awg (envelope-from ) for ; Fri, 03 Dec 2021 08:10:56 -0500 Received: by simark.ca (Postfix, from userid 112) id 1D8951F0CE; Fri, 3 Dec 2021 08:10:56 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-3.8 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, NICE_REPLY_A,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 8A2461ECEB for ; Fri, 3 Dec 2021 08:10:55 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 9608D3858430 for ; Fri, 3 Dec 2021 13:10:54 +0000 (GMT) Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) by sourceware.org (Postfix) with ESMTPS id 1CB353858D28 for ; Fri, 3 Dec 2021 13:10:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 1CB353858D28 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=palves.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wm1-f41.google.com with SMTP id y196so2303747wmc.3 for ; Fri, 03 Dec 2021 05:10:40 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=BFhf2Iwmmo8TirjtSvo0RFrNbdD1RwkTcZ+9sdqpX98=; b=rcPMnf84VBnGrxzGPxCbq5AKYB3vCpcga/qEErfH+oQnUmZIqEJaC0xZvvCP0kumpV kzP5swAv5xyV8wHWG+W9K3S0t6WY+zZUkFldEdsQ6We0WcbEAm/AGCGYckUTKXvsL6jC QDp+bkCLCqauPezVa/U8PDfM1yh3FbgZRt8c/3x8Lcp4kdk20MBVsx3dGT3yLyAexCy9 /FYpLjOfHllOGD18v678lVkRlAByh0KmMgGpqdJttD+68yzq8BQF320GcIfdIy+2ooFE X2aQtGmJ0qfxJIT1e12684Petw01ypnT+zVpz5mIWOh8JurMp2ECJs1cTt5ZXO9gVn8P AOfg== X-Gm-Message-State: AOAM532Xk01t3t+jb//LJf9zbXthOqO+/muZOwph+LMS0FymA0pIRIgK wopQubhcbEYmNWtkaxY6QlA= X-Google-Smtp-Source: ABdhPJzTBnVvPLeHcIh+B1vdOAJw3KnBDZ8Jd72b2GnclLADvfFuaX90qvOrT0Tx0ChXPZOsqacw5g== X-Received: by 2002:a05:600c:4e07:: with SMTP id b7mr14331056wmq.16.1638537039088; Fri, 03 Dec 2021 05:10:39 -0800 (PST) Received: from ?IPV6:2001:8a0:f912:1a00:fb57:3faf:e98:b979? ([2001:8a0:f912:1a00:fb57:3faf:e98:b979]) by smtp.gmail.com with ESMTPSA id r15sm4884176wmh.13.2021.12.03.05.10.37 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 03 Dec 2021 05:10:38 -0800 (PST) Message-ID: Date: Fri, 3 Dec 2021 13:10:36 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.3.2 Subject: Re: [PATCH 1/2] gdb: return *this in target_waitstatus setters Content-Language: en-US To: Simon Marchi , gdb-patches@sourceware.org References: <20211202014002.796783-1-simon.marchi@polymtl.ca> From: Pedro Alves In-Reply-To: <20211202014002.796783-1-simon.marchi@polymtl.ca> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Simon Marchi Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" On 2021-12-02 01:40, Simon Marchi via Gdb-patches wrote: > From: Simon Marchi > > While playing with some code creating target_waitstatus objects, I was > mildly annoyed by the fact that we can't just return a new > target_waitstatus object. We have to do: > > target_waitstatus ws; > ws.set_exited (123); > return ws; > > Make the setters return the "this" object as a reference, such that it's > possible to do: > > return target_waitstatus ().set_exited (123); > > I initially thought of adding static creation functions, which you would > use like: > > return target_waitstatus::make_exited (123); > > However, making the setters return a reference to the object achieves > pretty much the same thing, with less new code. I think the static methods would be nicer (I'd maybe drop the "make_" to keep it short), but I'm fine with this too, it doesn't seem mutually exclusive. Series LGTM.