Allocating adr_data_t Values

The first phase in the lifecycle of an adr_data_t is allocation. For each ADR type, there is at least one allocation routine. The arguments to an allocation routine depend on the type. In the case of mandatory immutable types, allocation implies initialization, and their allocation routines take the value of adr_data_t as arguments. Structures and arrays each have a single generic allocation routine that takes an adr_type_t* specifying the type of the structure or array. An adr_data_t is assigned values using a separate set of routines.

All allocation routines return a non-NULL adr_data_t * on success, or NULL on failure.

Note:

The allocation and initialization routines for immutable types may elect to return a reference to a shared adr_data_t for a commonly used value, for example, boolean true or false. This substitution should be undetectable by adr_data_t consumers who correctly manage adr_data_t reference counts and respect the immutability of these types.