#define P99_REALLOC (   X,
)    realloc((X), sizeof(T))

A type oriented realloc wrapper.

This macro receives an expression in T that is evaluated for its size as the second argument.

double * a = P99_REALLOC(0, double[10]); // allocate an array of 10 double
a = P99_REALLOC(a, double[20]); // re-allocate an array of 20 double
assert(a); // check if allocation was correct
As with the C library routine, the allocated space is uninitialized.
In contrast to the library call realloc this macro can not be used as a replacement for free, since the second argument can not be tricked to result in a size of 0.

Definition at line 228 of file p99_new.h.

#define P99_REALLOC(X, T)
A type oriented realloc wrapper.
Definition: p99_new.h:228