Skip to content

C23 Features

Derek Snider edited this page May 19, 2026 · 1 revision

C23 Features

madc includes early coverage of features from the C23 standard.

_Bool

_Bool flag = 1;
_Bool arr[3] = { 1, 0, 1 };

_Bool aliases to madc's bool type.

Binary literals

int x = 0b11001010;
int y = 0B1111;

static_assert / _Static_assert

Compile-time assertions with arithmetic, sizeof, and alignof expressions:

static_assert(sizeof(int) == 8, "int must be 8 bytes");
_Static_assert(sizeof(char) == 1, "char must be 1 byte");

typeof / typeof_unqual

Type inference from expressions or types:

int x = 42;
typeof(x) y = 100;          // y is int
typeof(int *) p = &x;       // p is int*

nullptr

Typed null pointer literal:

int *p = nullptr;
if (p == nullptr) {
    cout << "null" << endl;
}

Digit separators

Single quotes as visual separators in numeric literals:

int million = 1'000'000;
int hex = 0xFF'FF;
int bin = 0b1010'1010;
double pi = 3.141'592'653;

alignof / _Alignof

Query alignment requirements:

int a = alignof(int);            // 8
int b = alignof(double);         // 8
int c = alignof(char);           // 1

Works on primitives, pointers, structs, arrays, and member expressions.

restrict

Parsed as a no-op qualifier (accepted but not enforced):

void copy(char * restrict dest, const char * restrict src) {
    // ...
}

What's next?

Clone this wiki locally