M
Martijn
Hi,
I am looking over some of my old implementations. One of them has an
"array" of void pointers defined as a pointer to the first element (without
getting stuck on nomenclature, I am aware of the difference between a
pointer and an array).
This pointer in effect is a pointer to a void pointer: void**. But iirc,
this is not entirely valid and may become a problem when dereferencing and
doing pointer arithmetic. And in all honesty, it would still all compile
fine if I wrote void* instead of void**. The "array" has to be dynamic in
nature, that is, I need to resize it (using realloc) and the data stored is
represented as a void* to allow different types of pointers to be stored.
What is the proper way of going about implementing this? Thanks for any
pointers and if I've missed anything in the faq, let me know.
I am looking over some of my old implementations. One of them has an
"array" of void pointers defined as a pointer to the first element (without
getting stuck on nomenclature, I am aware of the difference between a
pointer and an array).
This pointer in effect is a pointer to a void pointer: void**. But iirc,
this is not entirely valid and may become a problem when dereferencing and
doing pointer arithmetic. And in all honesty, it would still all compile
fine if I wrote void* instead of void**. The "array" has to be dynamic in
nature, that is, I need to resize it (using realloc) and the data stored is
represented as a void* to allow different types of pointers to be stored.
What is the proper way of going about implementing this? Thanks for any
pointers and if I've missed anything in the faq, let me know.