P99
|
Macros for initialization and allocation. More...
Go to the source code of this file.
Macros | |
#define | P99_ALLOC(...) P99_IF_GT(P99_NARG(__VA_ARGS__), 1)(P00_ALLOC(__VA_ARGS__))(P00_VMALLOC(__VA_ARGS__)) |
#define | P99_APLAIN(...) |
#define | P99_ASUB(X, T, N, L) |
#define | P99_CALLOC(T, N) |
A type oriented replacement for calloc . More... | |
#define | P99_DECLARE_DELETE(T) |
Declare a ‘delete’ operator for type T. More... | |
#define | P99_DEFINE_DELETE(T) P99_INSTANTIATE(void, P99_PASTE2(T, _delete), T const*) |
#define | P99_FCALLOC(T, F, N) calloc(P99_FSIZEOF(T, F, N),1) |
Allocate an instance of struct T that is able to hold N items in flexible struct member F. More... | |
#define | P99_FHEAD(T, F, P) ((T*)(((char*)P) - offsetof(T, F))) |
For a pointer P to a flexible struct member F in struct T find the start address of the container. More... | |
#define | P99_FMALLOC(T, F, N) malloc(P99_FSIZEOF(T, F, N)) |
Allocate an instance of struct T that is able to hold N items in flexible struct member F. More... | |
#define | P99_FREALLOC(P, T, F, N) realloc(P, P99_FSIZEOF(T, F, N)) |
Reallocate an instance P of struct T such that it is able to hold N items in flexible struct member F. More... | |
#define | P99_FSIZEOF(T, F, N) P99_MAXOF(sizeof(T), offsetof(T, F) + P99_SIZEOF(T, F[0]) * N) |
Compute the size for an instance of struct T that is able to hold N items in flexible struct member F. More... | |
#define | P99_INITIALIZE(X, L) P00_ABLESS(P00_INITIALIZE((X), (L)), *(X)) |
#define | P99_MALLOC(X) malloc(sizeof(X)) |
A type oriented malloc wrapper. More... | |
#define | P99_MAXOF(A, B) ((A) < (B) ? (B) : (A)) |
#define | P99_MEMSET(TA, SO, N) p00_memset((TA), (void const*)&(SO), sizeof(SO), N) |
A type oriented replacement for memset . More... | |
#define | P99_MEMZERO(T, TA, N) p00_memset((TA), (void const*)&P99_LVAL(const T), sizeof(T), N) |
A type oriented replacement for memset with argument 0 . More... | |
#define | P99_MINOF(A, B) ((A) < (B) ? (A) : (B)) |
#define | P99_NEW(...) P99_IF_LT(P99_NARG(__VA_ARGS__), 2)(P00_NEW(__VA_ARGS__))(P00_NEW_ARGS(__VA_ARGS__)) |
Allocate an element of type T as given by the first argument and initialize it with the remaining arguments, if any. More... | |
#define | P99_PZERO(X, N) (memset((X), 0, sizeof(X[0]) * N)) |
Zero out all bits in the object to which X points. More... | |
#define | P99_REALLOC(X, T) realloc((X), sizeof(T)) |
A type oriented realloc wrapper. More... | |
#define | P99_SIZEOF(T, F, ...) P99_IF_EQ(P99_NARG(__VA_ARGS__), 1)(sizeof(__VA_ARGS__))(P00_SIZEOF2(__VA_ARGS__)) |
Determine the size of field F in structure T. More... | |
#define | P99_TZERO(X) (memset(&(X), 0, sizeof(X))) |
Zero out all bits in the object X. More... | |
Functions | |
size_t | p99_maxof (size_t p00_m, size_t p00_n) |
Macros for initialization and allocation.
Definition in file p99_new.h.