libSBML C API
5.18.0
|
Simple, generic list utility class. More...
Macros | |
#define | List_freeItems(list, free_item, type) |
Frees the items in the given List_t. More... | |
Simple, generic list utility class.
#define List_freeItems | ( | list, | |
free_item, | |||
type | |||
) |
Frees the items in the given List_t.
Iterates over the items in this List_t and frees each one in turn by calling the passed-in 'void free_item(type *)' function.
The List_t itself will not be freed and so may be re-used. To free the List_t, use the destructor.
While the function prototype cannot be expressed precisely in C syntax, it is roughly:
where type
is a C type resolved at compile time.
Believe it or not, defining List_freeItems() as a macro is actually more type safe than can be acheived with straight C. That is, in C, the free_item() function would need to take a void pointer argument, requiring any type safe XXX_free() functions to be re-written to be less safe.
As with all line-continuation macros, compile-time errors will still report the correct line number.