Blender V4.3
BLI_alloca.h
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#pragma once
6
13/* BLI_array_alloca / alloca */
14
15#include <stdlib.h>
16
17#if defined(__cplusplus)
18# include <type_traits>
19# define BLI_array_alloca(arr, realsize) \
20 (std::remove_reference_t<decltype(arr)>)alloca(sizeof(*arr) * (realsize))
21#else
22# if defined(__GNUC__) || defined(__clang__)
23# define BLI_array_alloca(arr, realsize) (typeof(arr))alloca(sizeof(*arr) * (realsize))
24# else
25# define BLI_array_alloca(arr, realsize) alloca(sizeof(*arr) * (realsize))
26# endif
27#endif