R
Rahul
Hi Everyone,
There was a discussion on the need of void * in C and C++. In C, it
is a generic pointer which can be typecasted to and from that of other
types.
And it is developer's head ache to take care that the cast to and
from void * is correct. C++ enhanced type cast dynamic_cast doesn't
help in this case, as it needs the type information. This makes me
wonder, why make a cast to void * and pass the info to other
functions? Why not simply pass the direct pointer?
Does anyone know the reason where void* only can solve the problem?
There was a discussion on the need of void * in C and C++. In C, it
is a generic pointer which can be typecasted to and from that of other
types.
And it is developer's head ache to take care that the cast to and
from void * is correct. C++ enhanced type cast dynamic_cast doesn't
help in this case, as it needs the type information. This makes me
wonder, why make a cast to void * and pass the info to other
functions? Why not simply pass the direct pointer?
Does anyone know the reason where void* only can solve the problem?