You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Because of the type of the free function this takes the most common use case of just passing 'free' produces a warning
Incompatible function pointer types initializing 'typeof (((&skined_anim_mngr.map))->map_types->t_key_free_func)' (aka 'void (*)(char *)') with an expression of type 'void (void *)'
Therefore wouldn't it make sense to change the type to void free(char *) ?
The text was updated successfully, but these errors were encountered:
Hi @pseregiet we could certainly accomplish what you are asking, but it would be at the cost of type safety. All the macros in hashmap.h perform a cast or assignment in order to allow the compiler to type check. While it is likely that free() will be used, we cannot presume that it will always be used. Thus, we have the choice of forcing the key free function to be void (*)(void *) (potentially breaking code that uses void (*)(key_type *)), or we accept any function pointer and cast it, which may result in crashes if an incompatible pointer is passed in. Neither sound particularly appealing.
My recommendation, would be to define a trivial function to wrap free() for your key type. E.g.
Because of the type of the free function this takes the most common use case of just passing 'free' produces a warning
Therefore wouldn't it make sense to change the type to void free(char *) ?
The text was updated successfully, but these errors were encountered: