From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id 780C63858D1E for ; Tue, 19 Apr 2022 00:20:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 780C63858D1E Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id 23J0JhCe025684 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 18 Apr 2022 20:19:48 -0400 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 23J0JhCe025684 Received: from [10.0.0.11] (192-222-157-6.qc.cable.ebox.net [192.222.157.6]) (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 1AA601E787; Mon, 18 Apr 2022 20:19:42 -0400 (EDT) Message-ID: <2178726e-9ac2-088e-490a-645b51b94b03@polymtl.ca> Date: Mon, 18 Apr 2022 20:19:42 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Subject: Re: [PATCH 5/5] gdbsupport: add path_join function Content-Language: en-US To: Pedro Alves , Lancelot SIX Cc: Simon Marchi , gdb-patches@sourceware.org References: <20220414200137.3479373-1-simon.marchi@polymtl.ca> <20220414200137.3479373-5-simon.marchi@polymtl.ca> <20220415143827.t2nlcfhmh2pondev@ubuntu.lan> <1343c861-94b4-d0e6-67af-dd6eb1f870c3@palves.net> <3f6204cc-514b-9bf7-6b9a-c89151075ede@polymtl.ca> <61f1d11c-d7c5-3b60-3e29-cd70a94a824f@palves.net> From: Simon Marchi In-Reply-To: <61f1d11c-d7c5-3b60-3e29-cd70a94a824f@palves.net> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Tue, 19 Apr 2022 00:19:43 +0000 X-Spam-Status: No, score=-3034.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org 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: , X-List-Received-Date: Tue, 19 Apr 2022 00:20:56 -0000 > Lancelot's approach seems more straightforward (trivially changed to use string_view) and > would also work, and it avoids creating the temporary array, at the expense of being > recursive when you have more than two components to join. Either approach seems > good to me. In Tom's approach, I think you could use gdb::array_view in concat. The array is stack-allocated, so it should not incur any significant cost. I'll stop looking for alternative ways, because at this point it really looks like bike-shedding, and I need to make progress :). I indeed switched to gdb::array_view in "concat", since that allowed me to use a range for. I also renamed concat to path_join (overloading my existing entry point). If some caller has paths in an array-like data structure (I don't know of any caller that does today), they'll be able to call the gdb::array_view version directly. Simon