From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by sourceware.org (Postfix) with ESMTPS id F0B9238708A3 for ; Fri, 18 Sep 2020 19:55:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org F0B9238708A3 Received: by mail-wr1-x432.google.com with SMTP id z4so6761176wrr.4 for ; Fri, 18 Sep 2020 12:55:56 -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:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=bpBb8qVn1ytCWPw5tGy4VvRl08ObSYmIlZUFikvf5Dg=; b=WGSVIVlUl3FnTDF2t7WO2EnTFT0X7retzB4+g1v4iTEsaTgcvabd8gLdb2XHSYGF2S gj5npFE+NGw40lOIjIvv/BhtjwPq416VVt2VLMCPJAWHzFvuo4UijgktRuJpeJkiW4fY 7WaqxdP5yCXiVezXUwEqhY3n4orLwbnAzOQo/xYlCmNix2iU7mnPUyGkJRIQ5abFc8cI XfGz3PYrObwDqzkogwVrZg1R6XAFVuC6rcQ5q8XHowOIL+LgPANSROUzitXUGL1c4rQN SK1nzpvh+N/ccWG5+fg7dkgqp7tpTEm0hLGfGDADaGpjPycftLecUvfn4G3Bzg+pftsu q+SA== X-Gm-Message-State: AOAM5327Wd8oBZDCCz2jLHKmd5UrQdGcjTRi6rXKKBWUdRhIn6iTiuds k/jX9IBdlwusaOBW9/CmUIGamxzgdh7gpA== X-Google-Smtp-Source: ABdhPJxfshuojVeg4zE64lrH4oMWcsD6dVhgXe+kO5BM/X2Z9Gs9LBjbMrTSwYoH0VlsvrF4nq288g== X-Received: by 2002:a5d:67c2:: with SMTP id n2mr37490971wrw.4.1600458955877; Fri, 18 Sep 2020 12:55:55 -0700 (PDT) Received: from localhost.localdomain ([170.253.60.68]) by smtp.googlemail.com with ESMTPSA id b64sm6976107wmh.13.2020.09.18.12.55.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Sep 2020 12:55:55 -0700 (PDT) From: Alejandro Colomar To: mtk.manpages@gmail.com Cc: linux-man@vger.kernel.org, libc-alpha@sourceware.org, Alejandro Colomar , Florian Weimer , Paul Eggert Subject: [RFC] system_data_types.7: Specify the length modifiers for the variables that have them Date: Fri, 18 Sep 2020 21:54:02 +0200 Message-Id: <20200918195401.117531-1-colomar.6.4.3@gmail.com> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, GIT_PATCH_0, 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: Fri, 18 Sep 2020 19:55:59 -0000 Reported-by: Florian Weimer Reported-by: Paul Eggert Signed-off-by: Alejandro Colomar --- Hi Florian and Paul, Thanks for the input. (for completeness, the thread was here: https://lore.kernel.org/linux-man/87imcb0y53.fsf@oldenburg2.str.redhat.com/). Would you maybe improve the wording? Or is it OK like this? Thanks, Alex man7/system_data_types.7 | 52 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/man7/system_data_types.7 b/man7/system_data_types.7 index b705ed5ae..4830a4a7d 100644 --- a/man7/system_data_types.7 +++ b/man7/system_data_types.7 @@ -107,6 +107,22 @@ capable of storing values in the range .BR "" [ PTRDIFF_MIN , .BR PTRDIFF_MAX ]. .IP +The length modifier for +.I ptrdiff_t +for the +.BR printf (3) +and the +.BR scanf (3) +families of functions is +.BR t ; +resulting commonly in +.B %td +or +.BR %ti +for printing +.I ptrdiff_t +variables. +.IP Conforming to: C99 and later; POSIX.1-2001 and later. .IP See also the @@ -339,6 +355,22 @@ it shall be an unsigned integer type capable of storing values in the range [0, .BR SIZE_MAX ]. .IP +The length modifier for +.I size_t +for the +.BR printf (3) +and the +.BR scanf (3) +families of functions is +.BR z ; +resulting commonly in +.B %zu +or +.BR %zx +for printing +.I size_t +variables. +.IP Conforming to: C99 and later; POSIX.1-2001 and later. .IP Notes: @@ -396,6 +428,26 @@ According to POSIX, it shall be a signed integer type capable of storing values at least in the range [-1, .BR SSIZE_MAX ]. .IP +Glibc provides a length modifier for +.I ssize_t +for the +.BR printf (3) +and the +.BR scanf (3) +families of functions, which is +.BR z ; +resulting commonly in +.B %zd +or +.BR %zi +for printing +.I ssize_t +variables. +Note that POSIX doesn't provide this length modifier, +and therefore portable programs should avoid using it. +Instead, such programs should cast the value to +.IR intmax_t . +.IP Conforming to: POSIX.1-2001 and later. .IP See also: -- 2.28.0