From: Florian Weimer <fweimer@redhat.com>
To: Paul Eggert <eggert@cs.ucla.edu>
Cc: libc-alpha@sourceware.org
Subject: Re: [PATCH v3 1/4] Document max_align_t
Date: Thu, 26 Feb 2026 13:41:46 +0100 [thread overview]
Message-ID: <lhu7brzn0c5.fsf@oldenburg.str.redhat.com> (raw)
In-Reply-To: <20260212182031.107003-2-eggert@cs.ucla.edu> (Paul Eggert's message of "Thu, 12 Feb 2026 10:18:11 -0800")
* Paul Eggert:
> * manual/lang.texi (Important Data Types): Mention max_align_t.
> ---
> manual/lang.texi | 28 ++++++++++++++++++++--------
> 1 file changed, 20 insertions(+), 8 deletions(-)
>
> diff --git a/manual/lang.texi b/manual/lang.texi
> index cd90ff60d2..28e7de2b2c 100644
> --- a/manual/lang.texi
> +++ b/manual/lang.texi
> @@ -16,7 +16,7 @@ features has been written, we are publishing it here.
> * Variadic Functions:: Defining functions with varying numbers
> of args.
> * Null Pointer Constant:: The macro @code{NULL}.
> -* Important Data Types:: Data types for object sizes.
> +* Important Data Types:: Types for sizes and alignments of objects.
> * Data Type Measurements:: Parameters of data type representations.
> @end menu
>
> @@ -555,7 +555,8 @@ recommend instead adding a prototype for the function you are calling.
> The result of subtracting two pointers in C is always an integer, but the
> precise data type varies from C compiler to C compiler. Likewise, the
> data type of the result of @code{sizeof} also varies between compilers.
> -ISO C defines standard aliases for these two types, so you can refer to
> +Also, it helps to have a data type with the greatest fundamental alignment.
> +ISO C defines standard aliases for these types, so you can refer to
> them in a portable fashion. They are defined in the header file
> @file{stddef.h}.
> @pindex stddef.h
> @@ -583,12 +584,23 @@ will be @w{@code{unsigned int}} or @w{@code{unsigned long int}}.
> arguments or variables that hold the size of an object.
> @end deftp
>
> -@strong{Compatibility Note:} Implementations of C before the advent of
> -@w{ISO C} generally used @code{unsigned int} for representing object sizes
> -and @code{int} for pointer subtraction results. They did not
> -necessarily define either @code{size_t} or @code{ptrdiff_t}. Unix
> -systems did define @code{size_t}, in @file{sys/types.h}, but the
> -definition was usually a signed type.
> +@deftp {Data Type} max_align_t
> +@standards{ISO, stddef.h}
> +@cindex fundamental alignment
> +This is an object type with the greatest @dfn{fundamental alignment},
> +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.
> +
> +@strong{Compatibility Note:} The C11 standard introduced @code{max_align_t};
> +older compilers may lack the type.
This version looks good to me.
Reviewed-by: Florian Weimer <fweimer@redhat.com>
Thanks,
Florian
next prev parent reply other threads:[~2026-02-26 12:41 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-12 18:18 [PATCH v3 0/4] malloc doc fixes for alignment Paul Eggert
2026-02-12 18:18 ` [PATCH v3 1/4] Document max_align_t Paul Eggert
2026-02-26 12:41 ` Florian Weimer [this message]
2026-02-12 18:18 ` [PATCH v3 2/4] Document malloc alignment Paul Eggert
2026-02-26 12:53 ` Florian Weimer
2026-02-26 12:56 ` Florian Weimer
2026-02-26 13:17 ` Florian Weimer
2026-02-12 18:18 ` [PATCH v3 3/4] Say malloc (0) != NULL is now common; resection Paul Eggert
2026-02-26 13:15 ` Florian Weimer
2026-02-12 18:18 ` [PATCH v3 4/4] malloc: alignment might change in future versions Paul Eggert
2026-02-26 12:47 ` Florian Weimer
2026-02-26 18:41 ` Paul Eggert
2026-02-26 18:38 ` [PATCH 1/2] doc: document max_align_t effect on ABI Paul Eggert
2026-02-26 18:38 ` [PATCH 2/2] doc: document C23 changes to intmax_t 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=lhu7brzn0c5.fsf@oldenburg.str.redhat.com \
--to=fweimer@redhat.com \
--cc=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).