From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id JxcSLGvNsV/CUAAAWB0awg (envelope-from ) for ; Sun, 15 Nov 2020 19:52:59 -0500 Received: by simark.ca (Postfix, from userid 112) id A76B01F08B; Sun, 15 Nov 2020 19:52:59 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=0.3 required=5.0 tests=MAILING_LIST_MULTI,RDNS_NONE autolearn=no autolearn_force=no version=3.4.2 Received: from sourceware.org (unknown [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 5EE2E1E58F for ; Sun, 15 Nov 2020 19:52:59 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C95B93857C46; Mon, 16 Nov 2020 00:52:58 +0000 (GMT) Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id C7BF13857C46 for ; Mon, 16 Nov 2020 00:52:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org C7BF13857C46 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=simark.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=simark@simark.ca Received: from [10.0.0.11] (173-246-6-90.qc.cable.ebox.net [173.246.6.90]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 6C1981E58F; Sun, 15 Nov 2020 19:52:56 -0500 (EST) Subject: Re: [RFA 2/6] gmp-utils: Convert the read/write methods to using gdb::array_view To: Joel Brobecker , gdb-patches@sourceware.org References: <1604817017-25807-1-git-send-email-brobecker@adacore.com> <1605430184-81335-1-git-send-email-brobecker@adacore.com> <1605430184-81335-3-git-send-email-brobecker@adacore.com> From: Simon Marchi Message-ID: <9fcbb9da-97d9-c0b2-a5b5-39f114fbe819@simark.ca> Date: Sun, 15 Nov 2020 19:52:56 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 MIME-Version: 1.0 In-Reply-To: <1605430184-81335-3-git-send-email-brobecker@adacore.com> Content-Type: text/plain; charset=utf-8 Content-Language: fr 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: , Errors-To: gdb-patches-bounces@sourceware.org Sender: "Gdb-patches" On 2020-11-15 3:49 a.m., Joel Brobecker wrote: > This commit changes the interfaces of some of the methods declared > in gmp-utils to take a gdb::array_view of gdb_byte instead of a > (gdb_byte *, size) couple. > > This makes these methods' API probably more C++-idiomatic. > With the way things are structured, this change introduces a minor > extra complication at the point of call of these methods, since > the data available there is not in the form of an array_view, > and thus the array_view needs to be constructed on the spot. I'd suggest using gdb::make_array_view (ptr, len) instead of the array_view constructor. This way, you don't need to specify the template type, it's automatically deduced, so it's a bit less verbose. Otherwise, LGTM. To alleviate the need to create array_view at all these points, I could very well imagine (as a future change that would probably be quite invasive) that the various value_contents functions could return array_view instead of plain pointers. Simon