From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from esa1.mentor.iphmx.com (esa1.mentor.iphmx.com [68.232.129.153]) by sourceware.org (Postfix) with ESMTPS id F38893858D28 for ; Tue, 13 Sep 2022 18:27:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org F38893858D28 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com X-IronPort-AV: E=Sophos;i="5.93,313,1654588800"; d="scan'208";a="85699452" Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa1.mentor.iphmx.com with ESMTP; 13 Sep 2022 10:27:53 -0800 IronPort-SDR: 40MZcXkqC0j7teHCwcAGrCRS++YkmSjDsQ4iWkEtdXW6pFRlsmzq/0KGF6tHZIxo55K1xMtohv 0pOhjVl9uJDydzjaFmI9r6Q463Bo7pXJ8Ne2oRaMzb7vlgL9rS4OTkXU1SUmUixAGm/SERLnpo Ke4oCqQxMW4dSoEE+dlg+gKTq/uLpmheu1EaUt6XH4dGGTTD0JnTSYGAzTfleC7jN6xlMhNrPx 82xfQPPnjwehoqaebasySeVV7KRp5CAQjKy0gdw/5ivBU1gZ671sFA/eOKVcdDYF0KlhXtNEnR 16s= Date: Tue, 13 Sep 2022 18:27:48 +0000 From: Joseph Myers X-X-Sender: jsm28@digraph.polyomino.org.uk To: Alex Colomar CC: , Florian Weimer , JeanHeyd Meneide Subject: Re: [PATCH] inttypes.h: imaxabs(3): Implement as a macro In-Reply-To: <20220913151853.153311-1-alx.manpages@gmail.com> Message-ID: References: <20220913151853.153311-1-alx.manpages@gmail.com> User-Agent: Alpine 2.22 (DEB 394 2020-01-19) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: SVR-IES-MBX-07.mgc.mentorg.com (139.181.222.7) To svr-ies-mbx-10.mgc.mentorg.com (139.181.222.10) X-Spam-Status: No, score=-3111.2 required=5.0 tests=BAYES_00,HEADER_FROM_DIFFERENT_DOMAINS,KAM_DMARC_STATUS,SPF_HELO_PASS,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=no 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 Tue, 13 Sep 2022, Alex Colomar via Libc-alpha wrote: > What do you think about using this implementation of imaxabs(3) in > glibc? Is it valid according to ISO C and/or POSIX? No. There has to be a prototype in the header for when #undef is used on the macro definition. Note that GCC expands imaxabs inline as a built-in function (unless using -std=c90 or -fno-builtin etc.). Note that C2x allows integer types wider than intmax_t in certain cases. So there is no standard obstacle to providing int128_t and uint128_t and having be fully integer types as defined in C2x, without needing to change intmax_t - although appropriate syntax would be needed for INT128_C and UINT128_C. (Changing intmax_t would be a pain because of the very large number of printf-like functions in glibc, all of whose ABIs involve intmax_t.) -- Joseph S. Myers joseph@codesourcery.com