Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp3883368ybe; Mon, 9 Sep 2019 00:11:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqwGbQmepp41Ehmnr5Sxxazx0HhTVncU+pZ2KbPolpV9hph/C1MPvY7/z/LGOu4EXZzj21vf X-Received: by 2002:a17:906:959:: with SMTP id j25mr17692127ejd.51.1568013093185; Mon, 09 Sep 2019 00:11:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568013093; cv=none; d=google.com; s=arc-20160816; b=e6as3WU+zerkS1EZmc12kc0eFa+PSA+0iF4XtRe8ZTjmG1NEoL4wSuODWfdrlDNsMm SSmwnnfFssR5zfHFsDpwXpMLO/m9k+WaB2JiI2/z3ncQrFa1DMDFIpZG+X/MblwCUQpS haPrqPdULsOx7R7Qb96JQDUeK9o/hhQmVtMVcxxGVpT8wDebZKtxRt0PoPruUFVCLLqq V51XE/hu3VsvVN0D/0EgcBBU28qG6A+fmqZA8SxVkLyYTSXJDKAAu9Vq+sZCIWqOnFT0 Y3cwx5UtyrwADh5apoeaRYtZ1XcdpQgWanUS9X733pooM16YHFftW//RwbuVCgOrEySn 5Fmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=kSwXjXzZYKJiCqywH51dxpo2qwU9GV6iT5gLa0TXjcw=; b=AmI9vzdTcpTYbunLADt2We/A07Nsxn5nQwOFgHcIVTNCVh4fgahIwccAvcnzeQ6T8V 2xc0BKWsospgienXlSvNaHWWXyYeJ43v7S5WHKOJH1B7LZEsHW7xxKBqSd7HDQjEhTuD O7iU0FYPt0vrp+OSyTCcd6Hp1nkUGiTMa0+H3sne0u12xhME+Yd3IwGX9xOSINbWFeDm SF2Zw19M8Ya4ctpD14jaJECrtOxWSR90S+77b8VZp/hcUFy38Uf4sjq2DF7ZrpfxGg7P s4FPrC1u0nTkPmgiRAcykilnUfE6c2XXl+uIyT+oZxkjQJJJ35v/ldyn6FckTEHwlXKA oUsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=RLvcUd52; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m17si7404427ejn.237.2019.09.09.00.11.07; Mon, 09 Sep 2019 00:11:33 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=RLvcUd52; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728494AbfIGUYH (ORCPT + 99 others); Sat, 7 Sep 2019 16:24:07 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:33058 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727012AbfIGUYG (ORCPT ); Sat, 7 Sep 2019 16:24:06 -0400 Received: by mail-pf1-f196.google.com with SMTP id q10so6725178pfl.0; Sat, 07 Sep 2019 13:24:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=kSwXjXzZYKJiCqywH51dxpo2qwU9GV6iT5gLa0TXjcw=; b=RLvcUd52lld4E+8udQ1d806EtK4KC7v/TKuhinRSgzE3aRETZCt2Gq4C35mRt0DHhI 3a38H9fkszjh52jqcN7Sf9eNmLFIV5gIgGHa28FjiPrM0EX1Y8fttthqtUrLC59XTuCh WKk+ZzHgzL0d05FkMU8Ha0r8lFt5BjYy7FXJ72HfZ23mI4AHlw5WKVfIG2iouipgiUAY mNCoRsilN7ixpWv+DrOENtYFR8Z3Jmw2ujry6Z7C89SkBXr2M2TUI5ClToGRC5LROBnG 1iEItEAmCc5fl9pYRy2Kp4TrelFSEE2mZ6QN/6WLoUbhk5Of41erqjuDxvHpDr4xcvtN kOFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=kSwXjXzZYKJiCqywH51dxpo2qwU9GV6iT5gLa0TXjcw=; b=BQ+IHwjDA7nYMtPcwA/X6v/oyuI/3UOP4d/CgkxVKkrripZ+ojin0yn2nqu0ndx/ul dY5zhuR1c/06boHsgpqGbBuqDlrNLrDIUxvCnlzm/cu8nhsaLy7HJi+umHvW35VDSAoa ADcqQ6csWtSE2xEebqToDF4QtQtpsa3TBASDJRUgX1Gprw2ck3CcAv8KrOYlJ0CwMG+j LF3KW+7IyTeDzXfcNf76Ma0RT3LUINFOffCK3ZYKK+juQgdmLVhY7ib+w0Pf++vfjffX MA2UoU1AozsBCom8Qeo8t7geYNxScJUfexDT3dPLrZblDyXYgUOvF97cFzBilOrkXQcA YkTQ== X-Gm-Message-State: APjAAAV1wOa4VE+XAV3agSQU28k4Lr+hjJ9JVl/yDpIF1yEui1lts2XS FhxX0jklbEZPXz+inU2OSwkqkpX05RKrEJdBXy5zBNRh X-Received: by 2002:a62:c141:: with SMTP id i62mr18689338pfg.64.1567887845980; Sat, 07 Sep 2019 13:24:05 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Andy Shevchenko Date: Sat, 7 Sep 2019 23:23:53 +0300 Message-ID: Subject: Re: [PATCH] docs: printk-formats: Stop encouraging use of unnecessary %h[xudi] and %hh[xudi] To: Joe Perches Cc: Jonathan Corbet , Linux Documentation List , linux-kernel , Louis Taylor Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Sep 7, 2019 at 9:15 PM Joe Perches wrote: > > Standard integer promotion is already done and %hx and %hhx is useless > so do not encourage the use of %hh[xudi] or %h[xudi]. > > As Linus said in: > Link: https://lore.kernel.org/lkml/CAHk-=wgoxnmsj8GEVFJSvTwdnWm8wVJthefNk2n6+4TC=20e0Q@mail.gmail.com/ > > It's a pointless warning, making for more complex code, and > making people remember esoteric printf format details that have no > reason for existing. > > The "h" and "hh" things should never be used. The only reason for them > being used if if you have an "int", but you want to print it out as a > "char" (and honestly, that is a really bad reason, you'd be better off > just using a proper cast to make the code more obvious). > > So if what you have a "char" (or unsigned char) you should always just > print it out as an "int", knowing that the compiler already did the > proper type conversion. > - char %hhd or %hhx > - short int %hd or %hx > + char %d or %x > + short int %d or %x > + s8 %d or %x > + s16 %d or %x This is incorrect. Integral promotions promotes also sign, which will produce too many f:s. -- With Best Regards, Andy Shevchenko