From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4B66AECAA24 for ; Thu, 25 Aug 2022 16:46:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243046AbiHYQp6 (ORCPT ); Thu, 25 Aug 2022 12:45:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42534 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243408AbiHYQpL (ORCPT ); Thu, 25 Aug 2022 12:45:11 -0400 Received: from mail-ed1-x52d.google.com (mail-ed1-x52d.google.com [IPv6:2a00:1450:4864:20::52d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 49535BCC2F for ; Thu, 25 Aug 2022 09:43:32 -0700 (PDT) Received: by mail-ed1-x52d.google.com with SMTP id r4so26844388edi.8 for ; Thu, 25 Aug 2022 09:43:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc; bh=Zej4CxY/1CWynJQcpIFCE/ePm/cZkXwlSREUqfzuJ8Y=; b=h5BQlI0xIEyNRWKjxWMt8RcIcaw6Iab9Lro//TN7cNvmYLCYmjHA9b7vqil1aO5lR2 jjncnbXB0E5n8vUT5r/OBW2cdzESp8HNiF0+6Am4i8gbPE/IF29BiN++mET+t+9HhGXy KU+7dVHbSPecBR62YILXw08KL2z9er7opHtdU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc; bh=Zej4CxY/1CWynJQcpIFCE/ePm/cZkXwlSREUqfzuJ8Y=; b=3XX4z7Vra8llst+59umCOzy6NSF6uEkqoz8KVjyxViLpaqSP7E0CTyeTaVxhgp22Ny aH/VJ/KzpMkZb3JQqywopiSpA5+RE0JkNYmF1Y1ANPzsoWONsqs5hNeBmNqAphXeiUCL VtFViuTNNuCRGf//yLqguU//AJFFWzS5wpoIYEGInfl1A+rLYfLWkobXLewcCE1gLUa9 9/sWe/hNlt9FOJqoD8ilrtGcoH9j4VVaaxq6LN0kurFKvR9sSUa77NRsBYiMoVcf02fh g/D6WPqcMQ9D4rqy5xYrHvljjuiJst9eaR8r1mLIFeAvexlxC9xK2Twizp3fIEmP/Duo ylLw== X-Gm-Message-State: ACgBeo26PrFFzi6aoFkHgmpDVB9gBEy2EAzJmU257xf7rJ9SOuC3qMIV +uRQzblC6tOI5y89y6SNdx+NofwPFmG7QwWUAD4= X-Google-Smtp-Source: AA6agR4DiGVR136YeqX23ZH+dnU0UYCydHqp4KwQcDeSkKDEcR7oy6Yf/s4EZpxoGmIr/d/7LJp5xA== X-Received: by 2002:a05:6402:530c:b0:43b:c6bf:a496 with SMTP id eo12-20020a056402530c00b0043bc6bfa496mr3846351edb.282.1661445809831; Thu, 25 Aug 2022 09:43:29 -0700 (PDT) Received: from mail-wr1-f48.google.com (mail-wr1-f48.google.com. [209.85.221.48]) by smtp.gmail.com with ESMTPSA id z2-20020a50eb42000000b0044687e93f74sm5185527edp.43.2022.08.25.09.43.28 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 25 Aug 2022 09:43:28 -0700 (PDT) Received: by mail-wr1-f48.google.com with SMTP id n17so732453wrm.4 for ; Thu, 25 Aug 2022 09:43:28 -0700 (PDT) X-Received: by 2002:a05:6000:1888:b0:222:ca41:dc26 with SMTP id a8-20020a056000188800b00222ca41dc26mr2680808wri.442.1661445807749; Thu, 25 Aug 2022 09:43:27 -0700 (PDT) MIME-Version: 1.0 References: <20210423230609.13519-1-alx.manpages@gmail.com> <20220824185505.56382-1-alx.manpages@gmail.com> <87ilmgddui.fsf@oldenburg.str.redhat.com> In-Reply-To: From: Linus Torvalds Date: Thu, 25 Aug 2022 09:43:11 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v3] Many pages: Document fixed-width types with ISO C naming To: Joseph Myers Cc: Florian Weimer , Greg Kroah-Hartman , Alejandro Colomar , Alexei Starovoitov , Alex Colomar , Alexei Starovoitov , linux-man , Daniel Borkmann , Zack Weinberg , LKML , glibc , GCC , bpf , LTP List , Linux API , linux-arch , David Laight , Cyril Hrubis , David Howells , Arnd Bergmann , Rich Felker , Adhemerval Zanella , Michael Kerrisk Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org On Thu, Aug 25, 2022 at 7:38 AM Joseph Myers wrote: > > I've not yet implemented it for glibc or for GCC format checking, but C23 > adds 'wN' format length modifiers so you will be able to e.g. use "%w64d" > with printf to print an int64_t and won't need those PRI macros any more. Yeah, that's going to help user space. We don't typically have huge issues with it (any more) in the kernel exactly because we refused to do the syntactically horrendous PRIxyz thing. So in the kernel, we still do have some format string issues, but they tend to be about "different architectures and configurations do different things for this type", and those different things are sadly not necessarily about a fixed width. IOW, we used to have horrors like "sector_t can be 32-bit or 64-bit depending on config options" (because small machines didn't want the overhead of having to pass 64-bit things around - from back when 32-bit was a primary target). We got rid of *that* thing a few years ago because it just wasn't worth supporting any more, but some similar issues remain. So we still have a number of cases of "if you really need to print this out, you need to use '%llui' and cast the value to 'unsigned long long'". But it's happily not as common as it used to be. Linus