From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from esa4.mentor.iphmx.com (esa4.mentor.iphmx.com [68.232.137.252]) by sourceware.org (Postfix) with ESMTPS id B43C43851C31 for ; Wed, 5 May 2021 22:22:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org B43C43851C31 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=joseph_myers@mentor.com IronPort-SDR: KNv6n29hMjRLRghZz3/5mdrBEgZD7mdBKL3Ek1O2auzAkjZI20VfR8PervyOzPHXdrdALyKY8G LWoTZcuQ5ww0bQb7u8rJy37OiehsfXrDhl/Nzy6kCqRZqjAFhS+HrYO62+v8XSnRfv1SwU/xuU KWlYSIUqF+h7gDMlYtCZbPC4oPIMAicFJnf23OV46CbH9ONoPWv8ObcBuEqS7wndvpL4bOsLLn lr1Ksi1Rqu0pFeDcT4bRPv4DFmf5sPUfjjVh0+Vez/GpuAqrRgAv4wWW0wDWj4Vkz/0P/1Fyxa BMI= X-IronPort-AV: E=Sophos;i="5.82,276,1613462400"; d="scan'208";a="61033683" Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa4.mentor.iphmx.com with ESMTP; 05 May 2021 14:22:23 -0800 IronPort-SDR: yYRQC2BGZ2EAkI+dghDlrq62ctnEzUdDXVCbEBB5v6z8SaTasrZVI5bDosiuTWtKQ2NxHxdwWc 3oaEz2Y7c647UoXHvp0Jj2i9+uTeeFU1nNVPEyxqSbzUptTVOede61SgQjqXAIbOkz6stZVKDn mIPzoD9dlTOxe3+0gwdVKx2TfSeRTKAuPj/prdhV8xBVRK9GeA3DHNoj16s0xugWhT0J5x8xoZ cXwQBuJ8n5lEUZvbfkJnbYidEW5iYccXWAiDJhogWxOLWMfHI0nrP95kZXqh7LHnNFKdajOksb CZc= Date: Wed, 5 May 2021 22:22:18 +0000 From: Joseph Myers X-X-Sender: jsm28@digraph.polyomino.org.uk To: David Laight CC: 'Florian Weimer' , "Alejandro Colomar (man-pages)" , linux-man , Daniel Borkmann , Greg KH , LKML , GCC , "Michael Kerrisk (man-pages)" , glibc , bpf , Alexei Starovoitov Subject: RE: [RFC v2] bpf.2: Use standard types and attributes In-Reply-To: Message-ID: References: <20210423230609.13519-1-alx.manpages@gmail.com> <20210504110519.16097-1-alx.manpages@gmail.com> <69fb22e0-84bd-47fb-35b5-537a7d39c692@gmail.com> <6740a229-842e-b368-86eb-defc786b3658@gmail.com> <87r1imgu5g.fsf@oldenburg.str.redhat.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-02.mgc.mentorg.com (139.181.222.2) To svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) X-Spam-Status: No, score=-1041.6 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2021 22:22:27 -0000 On Wed, 5 May 2021, David Laight via Libc-alpha wrote: > > __u64 can't be formatted with %llu on all architectures. That's not > > true for uint64_t, where you have to use %lu on some architectures to > > avoid compiler warnings (and technically undefined behavior). There are > > preprocessor macros to get the expected format specifiers, but they are > > clunky. I don't know if the problem applies to uint32_t. It does > > happen with size_t and ptrdiff_t on 32-bit targets (both vary between > > int and long). > > uint32_t can be 'randomly' either int or long on typical 32bit architectures. > The correct way to print it is with eg "xxx %5.4" PRI_u32 " yyy". C2X adds printf length modifiers such as "w32", so you can use a friendlier %w32u, for example. (Not yet implemented in glibc or in GCC's format checking.) -- Joseph S. Myers joseph@codesourcery.com