From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 08C8A3858035 for ; Fri, 14 Jul 2023 10:49:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 08C8A3858035 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1689331769; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=z1ohNVyDnFCKC9NSXZo8r/GRnI602sGadNV9Et0pyuI=; b=VxkIpuW7rlLeA90QKriG8pxj+QEmWgfDTnRfiJZMR4aEWlKpk2ndVOJT0d7q5k/fjhftfU xvK+IL0/GGsHBiwNIIooKNWUfQiYDfN/DFVLYTUG0E4MKI+Af/dE+mvC7idwYU8juGdNyG W9lMQpNOWRQh1/MCNhP5f+rkHVBDrk4= Received: from mail-lj1-f199.google.com (mail-lj1-f199.google.com [209.85.208.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-587-yKldcGVdMVGL-VlKXzU0tw-1; Fri, 14 Jul 2023 06:49:27 -0400 X-MC-Unique: yKldcGVdMVGL-VlKXzU0tw-1 Received: by mail-lj1-f199.google.com with SMTP id 38308e7fff4ca-2b743113ecdso17856841fa.0 for ; Fri, 14 Jul 2023 03:49:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689331766; x=1691923766; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=z1ohNVyDnFCKC9NSXZo8r/GRnI602sGadNV9Et0pyuI=; b=EeOg70z+ar2PzNJpBdC+B8Em22xsktJ+7+PPhpITNS5+l+L6RWShTSHyPPqJ4boYNg 9Ypo86LcO8QE1WM3E9qGWiERXZCXh751OD3SXRGIWtxKNne7lgANUUlXdP7CZCsam1Tv TFpfuNa26L6HCJOYYVOb8DybTmWJs3M3t+ly2+cPRXIbBTADmBDVIbhwIPstMF+iCuc+ O41XDdnLRwyLp281+8wBEVIKoKIR+kuDkgqInbHohD7vkB/CX2rdtSKBKmoLBcLlR9J9 lphNZV9RvzidGjouuLT0S5pLgSf8XC+DgKrMDDEfUk4ne8L56tw6BbpLmGZGUcR1lJ7O 74lQ== X-Gm-Message-State: ABy/qLbHol1HuaKFr81mBpouAJCUfbCxzaF4zZYU/JTLl+PvTTxUzp9P FhsokaXjPveirCwsQUV1DJO71gIYtVpp4esft31iqWvACAnQ0AnS90AXk2M4HURxG0R2aa+BJv3 As9t1hcRdQCbOsvaPMm16+6d+z5cyVQfFfeKjqXM= X-Received: by 2002:a2e:9805:0:b0:2b6:b6c4:6e79 with SMTP id a5-20020a2e9805000000b002b6b6c46e79mr3643809ljj.1.1689331766256; Fri, 14 Jul 2023 03:49:26 -0700 (PDT) X-Google-Smtp-Source: APBJJlFiysq6URPh5EfFDVnkIFldtXRjZWAjftzwH4cPlOPVTWHxbBXTpHvJ2WgDcvBXigxRehrUskH0Agou0xiRLLo= X-Received: by 2002:a2e:9805:0:b0:2b6:b6c4:6e79 with SMTP id a5-20020a2e9805000000b002b6b6c46e79mr3643794ljj.1.1689331766077; Fri, 14 Jul 2023 03:49:26 -0700 (PDT) MIME-Version: 1.0 References: <20230710052310.48116-1-kmatsui@gcc.gnu.org> <20230710053828.49793-1-kmatsui@gcc.gnu.org> In-Reply-To: From: Jonathan Wakely Date: Fri, 14 Jul 2023 11:49:14 +0100 Message-ID: Subject: Re: [PATCH v2 1/2] c++, libstdc++: implement __is_pointer built-in trait To: Ken Matsui Cc: Ken Matsui , gcc-patches@gcc.gnu.org, libstdc++@gcc.gnu.org X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-6.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Fri, 14 Jul 2023 at 11:48, Jonathan Wakely wrote: > > On Thu, 13 Jul 2023 at 21:04, Ken Matsui wrot= e: > > > > On Thu, Jul 13, 2023 at 2:22=E2=80=AFAM Jonathan Wakely wrote: > > > > > > On Wed, 12 Jul 2023 at 21:42, Ken Matsui = wrote: > > > > > > > > On Wed, Jul 12, 2023 at 3:01=E2=80=AFAM Jonathan Wakely wrote: > > > > > > > > > > On Mon, 10 Jul 2023 at 06:51, Ken Matsui via Libstdc++ > > > > > wrote: > > > > > > > > > > > > Hi, > > > > > > > > > > > > Here is the benchmark result for is_pointer: > > > > > > > > > > > > https://github.com/ken-matsui/gcc-benches/blob/main/is_pointer.= md#sun-jul--9-103948-pm-pdt-2023 > > > > > > > > > > > > Time: -62.1344% > > > > > > Peak Memory Usage: -52.4281% > > > > > > Total Memory Usage: -53.5889% > > > > > > > > > > Wow! > > > > > > > > > > Although maybe we could have improved our std::is_pointer_v anywa= y, like so: > > > > > > > > > > template > > > > > inline constexpr bool is_pointer_v =3D false; > > > > > template > > > > > inline constexpr bool is_pointer_v<_Tp*> =3D true; > > > > > template > > > > > inline constexpr bool is_pointer_v<_Tp* const> =3D true; > > > > > template > > > > > inline constexpr bool is_pointer_v<_Tp* volatile> =3D true; > > > > > template > > > > > inline constexpr bool is_pointer_v<_Tp* const volatile> =3D tru= e; > > > > > > > > > > I'm not sure why I didn't already do that. > > > > > > > > > > Could you please benchmark that? And if it is better than the cur= rent > > > > > impl using is_pointer<_Tp>::value then we should do this in the > > > > > library: > > > > > > > > > > #if __has_builtin(__is_pointer) > > > > > template > > > > > inline constexpr bool is_pointer_v =3D __is_pointer(_Tp); > > > > > #else > > > > > template > > > > > inline constexpr bool is_pointer_v =3D false; > > > > > template > > > > > inline constexpr bool is_pointer_v<_Tp*> =3D true; > > > > > template > > > > > inline constexpr bool is_pointer_v<_Tp* const> =3D true; > > > > > template > > > > > inline constexpr bool is_pointer_v<_Tp* volatile> =3D true; > > > > > template > > > > > inline constexpr bool is_pointer_v<_Tp* const volatile> =3D tru= e; > > > > > #endif > > > > > > > > Hi Fran=C3=A7ois and Jonathan, > > > > > > > > Thank you for your reviews! I will rename the four underscores to t= he > > > > appropriate name and take a benchmark once I get home. > > > > > > > > If I apply your change on is_pointer_v, is it better to add the > > > > `Co-authored-by:` line in the commit? > > > > > > Yes, that would be the correct thing to do (although in this case the > > > change is small enough that I don't really care about getting credit > > > for it :-) > > > > > Thank you! I will include it in my commit :) I see that you included > > the DCO sign-off in the MAINTAINERS file. However, if a reviewer > > doesn't, should I include the `Signed-off-by:` line for the reviewer > > as well? > > No, reviewers should not sign-off, that's for the code author. And > authors should add that themselves (or clearly state that they agree > to the DCO terms). You should not sign-off on someone else's behalf. You can add Reviewed-by: if you want to record that information.