From patchwork Sun Mar 15 20:32:40 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Eggert X-Patchwork-Id: 131762 X-Patchwork-Delegate: dj@redhat.com Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id C10A34C3184D for ; Sun, 15 Mar 2026 20:34:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C10A34C3184D Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=cs.ucla.edu header.i=@cs.ucla.edu header.a=rsa-sha256 header.s=9D0B346E-2AEB-11ED-9476-E14B719DCE6C header.b=Q01kI8DC X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail.cs.ucla.edu (mail.cs.ucla.edu [131.179.128.66]) by sourceware.org (Postfix) with ESMTPS id DB0CB4B1A342 for ; Sun, 15 Mar 2026 20:33:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DB0CB4B1A342 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=cs.ucla.edu Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=cs.ucla.edu ARC-Filter: OpenARC Filter v1.0.0 sourceware.org DB0CB4B1A342 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=131.179.128.66 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1773606787; cv=none; b=C/EghAFH6U/4pe5gRb3cJ6ad13SjZKn7Gm68N8k7uGF7GXivyicNQDgvYiwuvlwIty3LwZav5xf/DGSAQfPSprMgCyP7S7Vglvt9pagdJf0pQQp4zyofxjQuxHl6hq6Uyh4Z1Sj53hTm14iX/GLtK9aleQI+YefEo4EQ8xGOFB4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1773606787; c=relaxed/simple; bh=51jcJeO+OUmcnny3hI1J48GFla+3/idAsmCPOKtpTXY=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=m54KdWj8kIlMumQtnGK4EyU47KN6ZOOlwJsntVOKTf3gb8CrC84xr5HZRpJmMaMIQyiwp0bH0JhWUBXUb96dlp3LlgOqYhdbxPlZAQj3EtnRUW0k4wdR1cxoVAouPxUbI7wf2FgKsEr2eeK3xDiKtDDOY6F1zdw0a0wBQ5xMGfs= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DB0CB4B1A342 Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id 364BD3C005380; Sun, 15 Mar 2026 13:33:06 -0700 (PDT) Authentication-Results: mail.cs.ucla.edu (amavis); dkim=pass (2048-bit key) header.d=cs.ucla.edu Received: from mail.cs.ucla.edu ([127.0.0.1]) by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10032) with ESMTP id ZmjFnukc5DQl; Sun, 15 Mar 2026 13:33:06 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id 0EA313C01EBB7; Sun, 15 Mar 2026 13:33:06 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.cs.ucla.edu 0EA313C01EBB7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.ucla.edu; s=9D0B346E-2AEB-11ED-9476-E14B719DCE6C; t=1773606786; bh=jipp+RYnYX4tEFiIe+AroM9xJirp2yiTrdSYqrH2blU=; h=From:To:Date:Message-ID:MIME-Version; b=Q01kI8DCT/mBw54VJTJ5TMrKLGRzwtM5Kg/uyo/6e3VjliqbFOk++/LjNUvo90hYr dmMa9AZWQfqn44vzVZ0ZOMw/yj+RXEUTEBNJSfgBrfSLbCGGTQ0o98VF26eKyQCtpK wt4Dm3+S4cnh0e0PhorOIcMLsebVRBx3EitD9abRSjVzNSHBaB6WDxsbebMij4KG/y JPor7FuK2SeOE3tIPMnkTemuO3Fa0Fldy5M9VFHJ2SxbTOAr7rTo8CjzR7G6PHroXv zctlqdEizK4XE4BWcbdVqnQsmHiOuuMvkTdHwam8XTJx+O37Gh9F9wL3xExzTIoDYj WkkEJAJBuHiKA== X-Virus-Scanned: amavis at mail.cs.ucla.edu Received: from mail.cs.ucla.edu ([127.0.0.1]) by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10026) with ESMTP id hI2IckxEHn8l; Sun, 15 Mar 2026 13:33:05 -0700 (PDT) Received: from wing.home (47-143-214-216.fdr01.snmn.ca.ip.frontiernet.net [47.143.214.216]) by mail.cs.ucla.edu (Postfix) with ESMTPSA id EA6033C005380; Sun, 15 Mar 2026 13:33:05 -0700 (PDT) From: Paul Eggert To: libc-alpha@sourceware.org Cc: Paul Eggert Subject: [PATCH 1/2] doc: document max_align_t effect on ABI Date: Sun, 15 Mar 2026 13:32:40 -0700 Message-ID: <20260315203255.123865-2-eggert@cs.ucla.edu> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260315203255.123865-1-eggert@cs.ucla.edu> References: <20260315203255.123865-1-eggert@cs.ucla.edu> MIME-Version: 1.0 X-Spam-Status: No, score=-8.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, GIT_PATCH_0, KAM_EDU_FROM, RCVD_IN_DNSWL_BLOCKED, RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED, SPF_HELO_NONE, SPF_PASS, TXREP, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces~patchwork=sourceware.org@sourceware.org * manual/lang.texi (Important Data Types): Say that ABI changes if max_align_t changes. Reviewed-by: DJ Delorie --- manual/lang.texi | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/manual/lang.texi b/manual/lang.texi index 28e7de2b2c..5f6f74ebb9 100644 --- a/manual/lang.texi +++ b/manual/lang.texi @@ -592,15 +592,21 @@ i.e., the greatest alignment needed by standard types. Code can use @code{alignof (max_align_t)} when calculating space needed for arbitrary collections of objects, so long as the objects' types have a fundamental alignment and lack stricter alignment specifiers. -@end deftp In @theglibc{}, the value of @code{alignof (max_align_t)} is 16 on most architectures. However, it is 8 on 32-bit architectures that do not require 16-byte alignment from @code{malloc} to support predefined types. +Code that uses @code{max_align_t} should take into account the +variable alignment of the type. +For example, it is unwise for a public interface to rely on @code{max_align_t}, +as the interface's ABI can change if a different compiler defines +@code{max_align_t} differently. + @strong{Compatibility Note:} The C11 standard introduced @code{max_align_t}; older compilers may lack the type. +@end deftp @node Data Type Measurements @section Data Type Measurements From patchwork Sun Mar 15 20:32:41 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Eggert X-Patchwork-Id: 131763 X-Patchwork-Delegate: dj@redhat.com Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id 605DE4BBCDAF for ; Sun, 15 Mar 2026 20:34:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 605DE4BBCDAF Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=cs.ucla.edu header.i=@cs.ucla.edu header.a=rsa-sha256 header.s=9D0B346E-2AEB-11ED-9476-E14B719DCE6C header.b=OgfCbWSq X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail.cs.ucla.edu (mail.cs.ucla.edu [131.179.128.66]) by sourceware.org (Postfix) with ESMTPS id 94E724B1A36F for ; Sun, 15 Mar 2026 20:33:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 94E724B1A36F Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=cs.ucla.edu Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=cs.ucla.edu ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 94E724B1A36F Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=131.179.128.66 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1773606789; cv=none; b=iWvMaLoGvk/rta3WuJsm+7yyATKgXHK40BFr5D/T70o8h8CynDrh2WnRFrBqt+5IqlZxcadkUz15yAg1dHYYpt8S8w9I7+5vbXNIdmNHvfUaWVw5rt6lQ8gm970vemy/yHGdhmK6K4LOdHHMxyQegOPIGr8k92/wwe9DKgXiyAU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1773606789; c=relaxed/simple; bh=XefYJp1HNvsgR7hzO07U1DB6GtAfjvvCmgnh38CHeZs=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=gqz69WdrcIgOo/pmo/MSMHVMxZePG0nJaOreXAuj3zn3gfAeakuoZYsjUSFBUX/zePYTDhp3M+0EYEtBisxjQNKwozXE2PEangpgqu0RssLzJZc3ovMHAKbjoKUpJtNWg/oTWLStygh1pU3Apzy/42gLomBZ2cUzUBISSA9WbxY= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 94E724B1A36F Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id ED1633C005380; Sun, 15 Mar 2026 13:33:08 -0700 (PDT) Authentication-Results: mail.cs.ucla.edu (amavis); dkim=pass (2048-bit key) header.d=cs.ucla.edu Received: from mail.cs.ucla.edu ([127.0.0.1]) by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10032) with ESMTP id KHvQHg4enAfd; Sun, 15 Mar 2026 13:33:08 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id C8DDD3C01EBB7; Sun, 15 Mar 2026 13:33:08 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.cs.ucla.edu C8DDD3C01EBB7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.ucla.edu; s=9D0B346E-2AEB-11ED-9476-E14B719DCE6C; t=1773606788; bh=pSCik008DZAXQnvBFZyDzt4DD9H5xrR8qkf/KJ0ANJ8=; h=From:To:Date:Message-ID:MIME-Version; b=OgfCbWSqAIbxo7aoTEObpdEblUksxROvSTeMvnWoD6/ZnZ6p+jsk+yM/cnVGYpAgM zE3sTd5fEZT3F1WDbgGWgzpVi9tq+dz17q/V2LxQGbiFPm8xk+iHciTBMJ6OL7vnJ/ TK9bRSrRdJFrHn5PlgPYKJXFfzefKQMFQyexjR+VRVRLxZp0IgwJSvF/QX9LdHa9iB SEDjL7aRLQ6UXNmI1o5ZjHhhgy2LiDb2vDOCaDYYdNdjOhueIyshqj+rZsdEGfkrdi S9oLLm/80jXstkgmSW67p92uhk6Q9BcYQaD5joVFoPcjnIiB1zOs0yE0sahlqf0WYQ LTv9n9erZYuEQ== X-Virus-Scanned: amavis at mail.cs.ucla.edu Received: from mail.cs.ucla.edu ([127.0.0.1]) by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10026) with ESMTP id iMRCJ0-fLv06; Sun, 15 Mar 2026 13:33:08 -0700 (PDT) Received: from wing.home (47-143-214-216.fdr01.snmn.ca.ip.frontiernet.net [47.143.214.216]) by mail.cs.ucla.edu (Postfix) with ESMTPSA id B020A3C005380; Sun, 15 Mar 2026 13:33:08 -0700 (PDT) From: Paul Eggert To: libc-alpha@sourceware.org Cc: Paul Eggert Subject: [PATCH 2/2] doc: document C23 changes to intmax_t Date: Sun, 15 Mar 2026 13:32:41 -0700 Message-ID: <20260315203255.123865-3-eggert@cs.ucla.edu> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260315203255.123865-1-eggert@cs.ucla.edu> References: <20260315203255.123865-1-eggert@cs.ucla.edu> MIME-Version: 1.0 X-Spam-Status: No, score=-9.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, GIT_PATCH_0, KAM_EDU_FROM, RCVD_IN_DNSWL_BLOCKED, RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED, SPF_HELO_NONE, SPF_PASS, TXREP, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces~patchwork=sourceware.org@sourceware.org * manual/arith.texi (Integers): Say that intmax_t/uintmax_t might be narrower than some integer types. Use wording of C23. Also mention __int128, and that ABI changes if intmax_t changes. Reviewed-by: DJ Delorie --- manual/arith.texi | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/manual/arith.texi b/manual/arith.texi index df6d25e0ba..9f442e4bdd 100644 --- a/manual/arith.texi +++ b/manual/arith.texi @@ -96,16 +96,28 @@ one of these: @item uint_fast64_t @end itemize -If you want an integer with the widest range possible on the platform on -which it is being used, use one of the following. If you use these, -you should write code that takes into account the variable size and range -of the integer. +If you want an integer with a wide range, use one of these: @itemize @bullet @item intmax_t @item uintmax_t @end itemize +@noindent +The @code{intmax_t} type is wide enough to hold any signed integer value, +with the possible exceptions of signed bit-precise integer types, +and of @code{int@var{N}_t} types that are wider than @code{long long int}. +Compilers may also support other integer types wider than +@code{intmax_t}, such as GCC's @code{__int128}. +The @code{uintmax_t} type is like @code{intmax_t}, +except for unsigned integers. + +Code that uses @code{intmax_t} or @code{uintmax_t} should take into +account the variable size, range and alignment of the types. +For example, it is unwise for a public interface to rely on @code{intmax_t}, +as the interface's ABI can change if a different compiler +defines @code{intmax_t} differently. + @Theglibc{} also provides macros that tell you the maximum and minimum possible values for each integer data type. The macro names follow these examples: @code{INT32_MAX}, @code{UINT8_MAX},