---
name: "gnu::aligned"
section: "3attr"
platform: "linux"
package: "man-pages"
version: "6.19-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/gnu::aligned"
---

# gnu::aligned(3attr)

set alignment of an object

## NAME

gnu::aligned - set alignment of an object

## SYNOPSIS

```
[[gnu::aligned(alignment)]]
[[gnu::aligned]]
```

## DESCRIPTION

This attribute can be applied to a type or a variable, and sets its *alignment* in bytes.

If the *alignment* is not specified, the maximum alignment is used. This is equivalent to

```
[[gnu::aligned(alignof(max_align_t))]]
```

## VERSIONS

- **\_\_attribute\_\_((aligned(***alignment***)))**

  - **\_\_declspec(align(***alignment***))**

  C11 provides the **\_Alignas**() type specifier, which has similar semantics.

## STANDARDS

GNU.

## HISTORY

gcc, g++, clang 11, clang++ 2.8.0.

## CAVEATS

This attribute can increase the natural alignment of a type, but it can't decrease it.

The linker may limit the maximum alignment that can be applied.
