Doxygen Source Code Documentation
Main Page Alphabetical List Data Structures File List Data Fields Globals Search
onstack.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006 #ifndef _ONSTACK_H_
00007 #define _ONSTACK_H_
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #if HAVE_ALLOCA
00023
00024
00025
00026
00027 #if defined(__GNUC__)
00028 # if !defined(alloca)
00029 # define alloca __builtin_alloca
00030 # endif
00031 #else
00032 # if HAVE_ALLOCA_H
00033 # include <alloca.h>
00034 # elif defined(_AIX)
00035 # pragma alloca
00036 # endif
00037 #endif
00038
00039 # if !defined(ALLOCA_ARG_T)
00040 # define ALLOCA_ARG_T int
00041 # endif
00042
00043 # define ALLOC_ONSTACK(name, type, nelems) \
00044 type *const name = (type *) alloca((ALLOCA_ARG_T)((nelems) * sizeof(type)))
00045
00046 # define FREE_ONSTACK(name)
00047
00048 #elif defined(_CRAYC) && !__cplusplus && __STDC__ > 1
00049
00050
00051
00052
00053 # define ALLOC_ONSTACK(name, type, nelems) \
00054 type name[nelems]
00055
00056 # define FREE_ONSTACK(name)
00057
00058 #else
00059
00060
00061
00062
00063 # define ALLOC_ONSTACK(name, type, nelems) \
00064 type *const name = (type *) malloc((nelems) * sizeof(type))
00065
00066 # define FREE_ONSTACK(name) \
00067 free(name)
00068
00069 #endif
00070
00071 #endif