This repository has been archived on 2023-10-09. You can view files and clone it, but cannot push or open issues or pull requests.
Files
blender-archive/source/blender/blenlib/BLI_alloca.h

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

24 lines
592 B
C++
Raw Normal View History

/* SPDX-License-Identifier: GPL-2.0-or-later */
#pragma once
/** \file
* \ingroup bli
*
* Defines alloca and utility macro BLI_array_alloca
*/
/* BLI_array_alloca / alloca */
#include <stdlib.h>
#if defined(__GNUC__) || defined(__clang__)
2015-08-12 22:17:27 +02:00
# if defined(__cplusplus) && (__cplusplus > 199711L)
# define BLI_array_alloca(arr, realsize) (decltype(arr))alloca(sizeof(*arr) * (realsize))
# else
# define BLI_array_alloca(arr, realsize) (typeof(arr))alloca(sizeof(*arr) * (realsize))
# endif
2015-08-12 22:17:27 +02:00
#else
# define BLI_array_alloca(arr, realsize) alloca(sizeof(*arr) * (realsize))
#endif