Allocate an element of type T
as given by the first argument and initialize it with the remaining arguments, if any.
This supposes that the argument list is of the form
and that a function or macro named T_init
exists where T_init
is just the concatenation of the type name T
and ‘_init’. Thus T
must be a typename that consists of just one token: ‘signed’ would work but ‘signed long’ would not.
The T_init
function must have a signature that is compatible to one of
T* T_init(T*
p, OTHER_PARAMETERS);
- it must accept a pointer to
T
as a first argument
- it must be robust to the possibility of receiving a null pointer through that first argument (indicating an error condition)
- it should return the same pointer
p
- it may accept additional arguments which may then be passed through from the call to P99_NEW
- Returns
- value is a pointer to a newly allocated and initialized object of type
T
, or
(T*)0 if the allocation failed.
- See also
- P99_CALL_DEFARG if you want to provide default arguments to the
T_init
function.
Definition at line 314 of file p99_new.h.