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.133.124]) by sourceware.org (Postfix) with ESMTPS id 47D5C385E83E for ; Thu, 2 May 2024 19:48:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 47D5C385E83E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 47D5C385E83E Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1714679338; cv=none; b=g6LeDKeOXe5scEWVKpJQKv58CrTduX2MIgCIFo/gKjr3pwzNTh3wu/BpLk7cQdGUVygs0Xus1fFqFx/4UsXDksUPw7FUnjpdL1DiK4oa/pXyffERskiy427aCKkL/CRW6OyYPPwPCDmZIQkdD6huF19Yd8HuHUlX573L8Cwrr6I= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1714679338; c=relaxed/simple; bh=k/pyYWj3a0eFMcTpT7qKuY9JPgBebhcILMTtgzEfuRk=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=oTmq/koGDmiag9yZVXi2Hz32f99y3RGtQIFsrhJUpEa7iV5bINduAlMcWaF+ScHFtwssWffdBErrmAcMtBXeU3WWRpECpoUWtMSYh2kcyvEiMav4ov2Ost9AFXpZiLcEe7Cb326mQVrZhGGGc4Q5hcBgM+pgnW2jhJqyd12apkE= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1714679335; 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=H9ewelCYO7G6vSJ58EMeY9/J0bZlvOrFY8oG+pFaAws=; b=K1JzD/cTroxxCTXIwTtSW3gFjeNZD12du8HXNgZNHO83sCuVpXdOP5e3FDuHRPEH3rUeCY wZz1m81E52G+i0xiPraU1K1JIF9Co4TXrN2GEQRHtYI4jj2QtBnaCnbe1/pw4KIo4fE0vF XpSvKh/XTLKQoryMlndJQOojiU1etmI= Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-576-akqL3iXcOwutCW6YGqJIfw-1; Thu, 02 May 2024 15:48:54 -0400 X-MC-Unique: akqL3iXcOwutCW6YGqJIfw-1 Received: by mail-qk1-f200.google.com with SMTP id af79cd13be357-790eed8c223so821497785a.2 for ; Thu, 02 May 2024 12:48:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714679334; x=1715284134; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=H9ewelCYO7G6vSJ58EMeY9/J0bZlvOrFY8oG+pFaAws=; b=cuzMQED9CwZnoR7N5ds7tqjQkaTZEu3XVVPP5+OdsVdLyGOO8VBO4P2WrpVvpMKj4M F2Wu0uJfHvi8U36sdSXeXRc8pB8SHLcWcgRITjVWWsXAd9z566PsN5W8e/pdKUgzY1y+ YMzgXgPvF7PDCTyDZYQQJIasnPqANgcwGgAyIAFTii7RbMvpQULlBm+Yrjur+ilM0q2A t3fLxXCXSORvTWfsmf22NSDTXM+dH+03I7087Ce1Ip/5DSNnPxS2iBHDpyYfvuaiHh4T DBR+rNO8l3HnKHMLQ6SP+nEuph44KnRK29O8BljagFWbKkSmRaKnVncGpHwEyMp6/T5x Iycg== X-Forwarded-Encrypted: i=1; AJvYcCUjkh50DQNLzVG2HUfeI31P1mzktNAdpetw9ry9cyzO0a9JXsx/sY8mItk6tiVRFwHIdFPR1yU7GR7aVL71FRBcX6t9aG8kUg== X-Gm-Message-State: AOJu0YyvvEeZ9DHQSVRlJumv4LenKlXKauU2T06kRWrTB1z5fzDKVkEr YiRHZEbyII6H/7KA2UPcWTach4Ku2/wXPzjV0XR9/bm8U6r1ZMidQ/UIG7fsScsBdtbT1BvfyFF newOd2OseHwVLngPj+E76tlcQysAsnL+9GpiGkQBMu0/l8Reh1Exgfts= X-Received: by 2002:ad4:5746:0:b0:6a0:cd3e:aeb3 with SMTP id q6-20020ad45746000000b006a0cd3eaeb3mr737188qvx.32.1714679334086; Thu, 02 May 2024 12:48:54 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFZ82LvFAKvfUev+QmPa1BOVwR6wND2BO9ijtI7ke9h0OhQTq3+roiPfEUu868sfoV1ynBcVA== X-Received: by 2002:ad4:5746:0:b0:6a0:cd3e:aeb3 with SMTP id q6-20020ad45746000000b006a0cd3eaeb3mr737169qvx.32.1714679333724; Thu, 02 May 2024 12:48:53 -0700 (PDT) Received: from [192.168.1.130] (130-44-146-16.s12558.c3-0.arl-cbr1.sbo-arl.ma.cable.rcncustomer.com. [130.44.146.16]) by smtp.gmail.com with ESMTPSA id s13-20020ad4438d000000b006a0e04887edsm589797qvr.73.2024.05.02.12.48.52 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 02 May 2024 12:48:53 -0700 (PDT) Message-ID: Date: Thu, 2 May 2024 15:48:52 -0400 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Trait built-in naming convention To: Iain Sandoe , Ken Matsui Cc: Marek Polacek , Ville Voutilainen , Patrick Palka , Ken Matsui , GCC Patches , libstdc++@gcc.gnu.org References: <20240228192843.188979-1-kmatsui@gcc.gnu.org> <20240228192843.188979-22-kmatsui@gcc.gnu.org> <8b32b64d-8411-4792-9ffc-b81dbc189e52@redhat.com> <21abf361-86be-4c67-a845-9abc3a88a061@redhat.com> <14D48642-B157-4F2F-B008-F28691274E7A@googlemail.com> From: Jason Merrill In-Reply-To: <14D48642-B157-4F2F-B008-F28691274E7A@googlemail.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,KAM_SHORT,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham 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 5/2/24 15:36, Iain Sandoe wrote: > > >> On 2 May 2024, at 20:30, Ken Matsui wrote: >> >> On Thu, May 2, 2024 at 10:54 AM Marek Polacek wrote: >>> >>> On Thu, May 02, 2024 at 08:37:53PM +0300, Ville Voutilainen wrote: >>>> On Thu, 2 May 2024 at 20:25, Ken Matsui wrote: >>>>>> There was some discussion of how to name the built-ins back in >>>>>> https://gcc.gnu.org/pipermail/gcc-patches/2007-March/thread.html#212171 >>>>>> but __builtin wasn't discussed. >>>>>> >>>>>> Apparently this naming convention follows the MSVC precedent: >>>>>> http://msdn2.microsoft.com/en-us/library/ms177194.aspx >>>>>> >>>>>> I notice some discussion of this pattern around Clang adding various >>>>>> built-ins in https://github.com/llvm/llvm-project/issues/61852 >>>>>> indicating that this is a policy based on precedent. >>>>>> >>>>>> But I don't see any actual reason for this pattern other than that it's >>>>>> what Paolo happened to do in 2007. >>>>>> >>>>>> I'm not sure what the right way forward is. Perhaps we're stuck with >>>>>> the questionable choices of the past. >>>>>> >>>>> >>>>> Hmm, I personally prefer the __builtin prefix. However, it seems that >>>>> we need to reach a consensus across MSVC, Clang, and GCC. Would this >>>>> be realistically possible? >>>>> >>>>> Until then, I think it would be better to use __ for all built-in >>>>> traits. What do you think? >>>> >>>> My 0.02: __builtin as a prefix doesn't serve much of a purpose. >>>> Consider __is_constructible. It doesn't add value >>>> to make that __builtin_is_constructible. It's a built-in. Of course >>>> it's a built-in. It's a compiler-implemented trait, and >>>> this is just the intrinsic that implements it. >>> >>> FWIW, I also like __is_constructible better than __builtin_is_constructible. >> >> So, updating all existing built-in trait names does not seem >> realistic. I think there are two options: >> >> 1. As Jason said, we can use the same name as Clang does and otherwise >> use __builtin. >> 2. Or we can simply use __ for all built-in traits to keep consistency >> with other built-in traits. >> >> Then, I feel option 2 would sound better since it's consistent across >> all built-in type traits and it might confuse Clang when they >> implement the same built-in. Also, it would be easier for me to >> implement built-in traits as I don't need to dig into the Clang code >> every time I add a new one. > > I agree, being consistent with the status-quo is valuable, some decisions > might have not be the best ones - but I think it would be terribly confusing > to mix __ and __builtin (it immediately makes the reader wonder whar the > difference is). This seems to be the prevailing sentiment, so let's continue that way. Thanks for the input. Jason >>>> Most of the existing builtins for traits don't use a __builtin prefix. >>>> Not in GCC, not in other compilers. They are indeed >>>> just double-underscored versions of the traits. I think that's fine, >>>> and consistent. There's precedent for this >>>> across Embarcadero, Clang, MSVC, and GCC. See >>>> https://clang.llvm.org/docs/LanguageExtensions.html >>>> >>>> Yes, I know it's inconsistent with other built-ins that aren't C++ >>>> library traits. But the water's been flowing under >>>> the bridge on that question for a while now. >>>> >>>> I would also prefer at least considering mimicking a trait builtin's >>>> name if some other compiler did it first. That's not a hill >>>> to die on, we don't need to be 100% compatible including the naming, >>>> but if we can, we should just use a name that was >>>> chosen by someone else already. It's just nice to have the same name >>>> if the traits do exactly the same thing. If they don't, >>>> then it's good and in fact very good to give our trait a different name. >>>> >>> >>> Marek >