Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Not much of a C programmer, what's the context around void* being a big deal?


Void pointers refer to anything and nothing. They are everything and all encompassing. What is pointed to by the void pointer could be what you want or it could be another universe.

Dereferencing a void pointer has no meaning. The compiler can do anything it wants because it doesn't know how to interpret the memory. It could give you the correct thing, it could warp a civilization in from a distant planet, or it could open a world-ending black hole. All are equally probable.


You're correct, although I'm fairly sure dereferencing a `void*` is a compile error on all but the most ancient and non-conforming compilers. I'm not even sure what it _could_ compile to, given that `void` has no size.


void * was introduced after char * had been the pre-standard way of addressing any memory. Compilers of the era would let you use void * like char *, because it made it easier to change char * into void *.


Yes most modern C compilers will stop you from dereferencing a void pointer. Still, I couldn't help but bring up what can happen. Since I didn't witness it I can only assume 3 mile island was someone dereferencing a void pointer and it was easier to explain with a nuclear meltdown.


It really should be specified to specifically summon nasal demons, IMO.


Has any civilization been warped in already?


Not to my knowledge, but there seems to have been a slow warping out of civilization in recent years.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: