From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-x343.google.com (mail-wm1-x343.google.com [IPv6:2a00:1450:4864:20::343]) by sourceware.org (Postfix) with ESMTPS id 09C2B3857C61 for ; Sun, 20 Sep 2020 23:00:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 09C2B3857C61 Received: by mail-wm1-x343.google.com with SMTP id x23so10325100wmi.3 for ; Sun, 20 Sep 2020 16:00:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:subject:to:message-id:date:user-agent :mime-version:content-language:content-transfer-encoding; bh=fMbGiIrX6jPbhDXGAs+SrE8X3CEcO8dc4rNizwIWKuI=; b=ArPdxf7xSk2oFspwhh7HaR3wNy6jhILwdEw1itvoehEbaO3y+93BJajvXJFpEc+jfc 2HkQBhtdXkKxZjlnS/DhHkYgtLhBpIEvvWnJU1D1ZGwuKXfBkrVVqSt39H5GD/tt6AkX qfEjgfx9tweIzsxc6RtK2ktGswIZLjF5WA4+swHJGAf1uo1TfLTXGe8l9X+ferB7PlDM wVIqOd5wSSwut79pA3A7rrHY4Gfi0+Dl7WnJrVjD3qaWSwdGQ3A7DcdlXTePl1Eeoijx eXpYCpZ1amfgVbOzL+UqRUF7+6g3guoF29NhsQR72X/d61rPJOc1cC2UQXysVrtIvtSj lvWw== X-Gm-Message-State: AOAM533blrfbtkiPFssPqwHUTO1KDq/th9wusnish0/83S9QPvJo6jko bu+8z5T6RYZal/idGwH/XSsO0szm/3o= X-Google-Smtp-Source: ABdhPJxOsI2NlALo6d7g+F6Tn3uVCroSmxvhUGBwPmxpjZE+SfohSWl43eDGU9y2RznNu4lz1HhH+Q== X-Received: by 2002:a7b:c1d9:: with SMTP id a25mr28124280wmj.4.1600642808712; Sun, 20 Sep 2020 16:00:08 -0700 (PDT) Received: from [192.168.0.160] ([93.115.133.118]) by smtp.gmail.com with ESMTPSA id o4sm17081261wrv.86.2020.09.20.16.00.07 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 20 Sep 2020 16:00:08 -0700 (PDT) From: Alejandro Colomar Subject: Expose 'array_length()' macro in or To: libc-alpha@sourceware.org Message-ID: <946e9377-0558-3adf-3eb9-38c507afe2d0@gmail.com> Date: Mon, 21 Sep 2020 01:00:07 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-5.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, KAM_SHORT, 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: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Sep 2020 23:00:11 -0000 Hi, I'd like to propose exposing the macro 'array_length()' as defined in 'include/array_length.h' to the user. Libbsd provides '__arraycount()' in and some BSDs provide 'nitems()' in , so any of those 2 headers may be a good place to do it. That would provide a safe macro for many users that don't know how to write it safely, or just don't feel like typing a few extra lines, and it would also help not needing to write such a macro for all projects, because really most of them need it. Also, the new GCC warning -Wsizeof-pointer-div has some problems: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94746 What do you think about it? Thanks, Alex