[TUHS] origins of void* -- Apology!
Ralph Corderoy
ralph at inputplus.co.uk
Thu Nov 9 03:44:50 AEST 2017
Hi Bakul,
> void* serves a different purpose. It says this is an untyped pointer
> (or a ptr to an instance of any type) so no question of size being an
> issue.
In C, ignoring POSIX, a void pointer is big enough to hold any pointer
to data. Pointers to data may be different sizes. And a void pointer
can't hold a function pointer, but all function pointers are defined to
be the same size. Thus `void (*)(void)' can be used as a generic
function pointer type and cast to other ones when needed.
> It shouldn't even have been "void*". I would've preferred _* and _
> instead of void* and void. Much more appropriate for a concise
> language like C!
That's awful. Might as well say `return' occurs so often, it should
have been `@'. :-)
--
Cheers, Ralph.
https://plus.google.com/+RalphCorderoy
More information about the TUHS
mailing list