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 5EC82384AB71 for ; Thu, 2 May 2024 19:48:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5EC82384AB71 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 5EC82384AB71 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1714679338; cv=none; b=jb7hbbgipxWu09JhVe+f9IQJ6zrmMxln9DELA6ObRx32EwIfG36xN5W6+EeXNGaraVA/6WYBxF5t3NZuvNhPyzebNBpANjrwQNIaTvjqDei5eb3+YooK/ev+Sa8DFAd4+Umqdccb/yKSYoorzRbUicCicOn1H0iefgBMK8h96W4= 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=Ap+12om1QmM0tkuDB7YWeKUVdJoNERTpg5hwdwpoc8Jv7yeLn8WHMyO93tHBoigg9YpfCg+6alKn9dJ4mMKIpB2zIpvQ5Vj04w6l2K9V/kBvcwiLhPkvDwk4/lfcV27rABy/7M95T5jutGf1/VZO87eawoetby+Dt007VtePeCU= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1714679336; 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=hi8vCW0oWKzmKzBh32RW8PeQpj9+078TzbHXTETmu9sasvmLn/IjA6eiEYCO66r77Zs/CY PFX5t/nJ1ouahe/0kgVbdVYDFE6iRsxqodd7sVcjtpF8Iyubmz810EV0G5x2yFL2+HSKL8 7UIixYgBvPLdbpdCGL5q0V0WTiKPAcg= Received: from mail-qv1-f71.google.com (mail-qv1-f71.google.com [209.85.219.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-647-rUzBX43iM4-imoDUXs-c6w-1; Thu, 02 May 2024 15:48:54 -0400 X-MC-Unique: rUzBX43iM4-imoDUXs-c6w-1 Received: by mail-qv1-f71.google.com with SMTP id 6a1803df08f44-6a0e2e00bddso30220846d6.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=KMnLLGwX9iMADNnmoy9CGf+NRLQabRYclCUfWrkX3rCtvGVmFxPEu/Z2BcbNnMCKcR eUQd3moYCpEjwse34Hx1pHy+q6IfpDATUfqyuwDqcLksrHDP6XztgysoBCyCLC5kgsEI b3KDey4+uJpbKg/V5E1fcpHqIBS1NF4uyrLntE6liH58JvrjnCBwiXoSk1j/+Y9ZDv8x UL19kL6ymM8v5hzoLUavw3ix6Iix5mHtMEnSNKBCD47H9ifVC8QK9/SdYrajgZrZZ6cz 1qBEMFAfB8aRRZXeYRcve33i+hOvBtvTTOGhTsPy6acf9ndtWSnYfSteLS0q7AOsKa3R LxQA== X-Forwarded-Encrypted: i=1; AJvYcCWoG+b9GU+PdxKFVcMVP120nSDyhmqSPnnSUw1zEtCUPnnFCQkhtS2iNqwIgVLDhavLLgQRZBTJLMN7OsAvtm9Zr3Bdseg= X-Gm-Message-State: AOJu0YyuZqzbwtyBjEZz01JoyPePbf+oHzTQ1YNMCkquwj8Rptdxgoe7 PpN7tkYYIB2uCmvgwdrCtE6Fp6R6hlFXQBCtQ3mNcwHjWWpmNA+oxAEDRZaVcF3fbiggPG286bJ lJ8lpZG1vnsuBZqaDAemBebg16wnS7Pv/yxqftpMGasI5OgWLnnfd X-Received: by 2002:ad4:5746:0:b0:6a0:cd3e:aeb3 with SMTP id q6-20020ad45746000000b006a0cd3eaeb3mr737189qvx.32.1714679334101; 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=-3.7 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,RCVD_IN_SORBS_WEB,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 >