SDL_ALLOC_SIZE(3)

SDL_ALLOC_SIZE3

A macro to tag a function as returning a certain allocation.

Usage

#include "SDL3/SDL.h"

#define SDL_ALLOC_SIZE(p) __attribute__((alloc_size(p)))

Header file

Defined in SDL3/SDL_begin_code.h

Overview

This is a hint to the compiler that a function allocates and returns a specific amount of memory based on one of its arguments. For example, the C runtime's malloc() function could use this macro with an argument of 1 (first argument to malloc is the size of the allocation).

On compilers without alloc_size support, this is defined to nothing.

Most apps don't need to, and should not, use this directly.

Availability

This macro is available since SDL 3.2.0.

From libsdl3-doc 3.2.10+ds-1 in Debian 13 (Trixie). Parsed by carta from the page's man source.