Void pointer can be flexibly converted into vary types with the cost of type
cast.
Also, the data structure size is not changing, but a two pointers: one is
the necessary next pointer, the other is datum.
here is the what I said "cost" from one of my favorite person's blog.
"We usualy use void* to implement generic containers in C. To do in this way
, we need to pay an overhead on retrieving data pointed by a void* pointer.
We often, but not always, need a function call for operations on void* data,
such as copying, comparing or hashing. This adds additional overhead on
speed. Furthermore, if the size of an object is small, we would rather put
the whole object in the container instead of wasting the memory for an
addition pointer: using void* may also bring memory overhead."
Using void* in Generic C Programming may be Inefficient depends on how heavily type cast called. Instead, C macro is
part of the idea how c++ implement its generic template mechanism.