From: Paul Eggert <eggert@cs.ucla.edu>
To: libc-alpha@sourceware.org
Cc: Paul Eggert <eggert@cs.ucla.edu>
Subject: [PATCH 1/2] doc: document max_align_t effect on ABI
Date: Sun, 15 Mar 2026 13:32:40 -0700 [thread overview]
Message-ID: <20260315203255.123865-2-eggert@cs.ucla.edu> (raw)
In-Reply-To: <20260315203255.123865-1-eggert@cs.ucla.edu>
* manual/lang.texi (Important Data Types): Say that ABI changes if
max_align_t changes.
---
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
--
2.51.0
next prev parent reply other threads:[~2026-03-15 20:33 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-15 20:32 [PATCH 0/2] document improvements for max_align_t, intmax_t Paul Eggert
2026-03-15 20:32 ` Paul Eggert [this message]
2026-03-18 1:44 ` [PATCH 1/2] doc: document max_align_t effect on ABI DJ Delorie
2026-03-15 20:32 ` [PATCH 2/2] doc: document C23 changes to intmax_t Paul Eggert
2026-03-18 1:47 ` DJ Delorie
-- strict thread matches above, loose matches on Subject: below --
2026-02-26 18:41 [PATCH v3 4/4] malloc: alignment might change in future versions Paul Eggert
2026-02-26 18:38 ` [PATCH 1/2] doc: document max_align_t effect on ABI Paul Eggert
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260315203255.123865-2-eggert@cs.ucla.edu \
--to=eggert@cs.ucla.edu \
--cc=libc-alpha@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).