Function rcutils_get_zero_initialized_string_array

Function Documentation

rcutils_string_array_t rcutils_get_zero_initialized_string_array(void)

Return an empty string array struct.

This function returns an empty and zero initialized string array struct. Calling rcutils_string_array_fini() on any non-initialized instance leads to undefined behavior. Every instance of string_array_t has to either be zero_initialized with this function or manually allocated.

Example:

rcutils_string_array_t foo;
rcutils_string_array_fini(&foo); // undefined behavior!

rcutils_string_array_t bar = rcutils_get_zero_initialized_string_array();
rcutils_string_array_fini(&bar); // ok