From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) by sourceware.org (Postfix) with ESMTPS id 6155A398B817; Fri, 25 Sep 2020 17:46:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 6155A398B817 Received: by mail-wr1-x442.google.com with SMTP id k15so4518819wrn.10; Fri, 25 Sep 2020 10:46:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=DasmCBY/wQlr/0J2E3YdX27/0Xwh8coAPdNm+mY0gxo=; b=P4FqwNhzOohY/2YrfPCkpcN+lgdfvX5Pf6dR7L4XESKclRZ5hfSmzVoSIkms9BoMUB mw8sKlAVCcuGizKl6HCIa2A+EQHh7ARhqFTWE5CCbn3yAmyWuhJ7wd68vCNIp5uVbyT7 CrezKCLrCNM9Bcze6QZw/91Q0yRBiX9EjALNFMUuzoqsV5uFYm0n7zQGd9IiM06UaK1+ iYYAuaghf14pNLY6u6Oc8Fv630HeMRoMAPdRGgyWUAXZS0UIY96p3Y7fAgGzXYq02OYf xV+9fiZGgRS5cRY1R+V9wpd6YCF25r2DdWyvLTQo60IMLBe+ypeC+aJRJ+cfy5fvAWPA u84g== X-Gm-Message-State: AOAM53312Dk17l/N7i0I7jDLcEBGIyf59lTE9UyOFkEEE0g+Bv2QAwid 7+b0P5qhlL9Z3ZHSRuTqYHo= X-Google-Smtp-Source: ABdhPJyh3QXyThiBe9yeSw9Yh8lRFZO7Hu9wXz+dDehB5AoOPFjOAG3ht3gxa02t+7zFBo6lMXuHkw== X-Received: by 2002:a5d:4486:: with SMTP id j6mr5520651wrq.278.1601055966425; Fri, 25 Sep 2020 10:46:06 -0700 (PDT) Received: from [192.168.1.143] ([170.253.60.68]) by smtp.gmail.com with ESMTPSA id w21sm3880599wmk.34.2020.09.25.10.46.05 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 25 Sep 2020 10:46:05 -0700 (PDT) Subject: Re: [PATCH v2] : Add nitems() and snitems() macros To: Jonathan Wakely Cc: fweimer@redhat.com, linux-man@vger.kernel.org, libc-alpha@sourceware.org, gcc@gcc.gnu.org, rusty@rustcorp.com.au, linux-kernel@vger.kernel.org, libstdc++@gcc.gnu.org, libc-coord@lists.openwall.com, enh@google.com References: <20200922145844.31867-1-colomar.6.4.3@gmail.com> <20200925132000.235033-1-colomar.6.4.3@gmail.com> <20200925144822.GM6061@redhat.com> <22c110fe-4c92-e5e6-dc35-dbf00a97cfa2@gmail.com> <20200925174252.GO6061@redhat.com> From: Alejandro Colomar Message-ID: Date: Fri, 25 Sep 2020 19:46:04 +0200 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: <20200925174252.GO6061@redhat.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libstdc++@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++ mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Sep 2020 17:46:08 -0000 On 2020-09-25 19:39, Jonathan Wakely wrote: > Yes, I'm aware of all the rationale. I already said that it makes > sense in C++ where you have generic code. I am not convinced that it's > necessary to add to when all it does is a cast from > size_t to ptrdiff_t. > While I would prefer a signed version, I could live with only 'nitems()'. Having all the __must_be_array thing is the most important part. On 2020-09-25 19:42, Jonathan Wakely wrote: > On 25/09/20 18:30 +0200, Alejandro Colomar via Libstdc++ wrote: >> I have a similar number of ARRAY_SIZE() and ARRAY_SSIZE(). >> I could have '#define snitems(arr) ((ptrdiff_t)nitems(arr))' in my >> projects, >> but is it really necessary? > > The barrier for adding something to glibc headers should be a LOT > higher than "I could [do it in my own code], but is it really > necessary?" > >> Did I convince you? :-) > > No. > > Well, you convinced me :) I'll rewrite the patch, and the problem about will vanish. Cheers, Alex