[1/2] doc: document max_align_t effect on ABI

Message ID 20260226184220.66519-1-eggert@cs.ucla.edu (mailing list archive)
State New
Headers
Series [1/2] doc: document max_align_t effect on ABI |

Checks

Context Check Description
redhat-pt-bot/TryBot-apply_patch success Patch applied to master at the time it was sent
linaro-tcwg-bot/tcwg_glibc_build--master-arm success Build passed
linaro-tcwg-bot/tcwg_glibc_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_glibc_check--master-arm success Test passed
linaro-tcwg-bot/tcwg_glibc_check--master-aarch64 success Test passed

Commit Message

Paul Eggert Feb. 26, 2026, 6:38 p.m. UTC
  * 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(-)
  

Patch

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