Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / C

max_align_t — greatest fundamental alignment

max_align_t from <stddef.h> represents the greatest fundamental alignment, not a limit on every alignment an implementation supports.

Version: C23; repository compiler flag, production runtime not attested

Syntax

#include <stddef.h>
max_align_t object;
alignof(max_align_t)

max_align_t is an object type provided by <stddef.h> whose alignment is the greatest fundamental alignment. Alignment restricts the addresses at which an object can reside.

In C23, query it with alignof(max_align_t). Do not confuse alignment with the size sizeof(max_align_t); assume neither a particular numeric value nor a representation.

Supported alignments above this value are extended; their availability and supported storage durations are implementation-defined. The example checks the guaranteed relationship for double instead of printing a platform-dependent value.

Examples

#include <stddef.h>
#include <stdio.h>

static_assert(alignof(max_align_t) >= alignof(double),
              "double requires fundamental alignment");

int main(void)
{
    printf("%d\n", alignof(max_align_t) >= alignof(double));
    return 0;
}

Result

1

The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.

Sources