3 ms·
"a typedef name was a complete surprise to me at this point in your program" Ah, the joys of fun compiler messages. I miss those days. I remember getting one
by mkovach 3y ago
"a typedef name was a complete surprise to me at this point in your program"
Ah, the joys of fun compiler messages. I miss those days. I remember getting one from a vendor compiler that was:
"No! But they'll only let me warn you. Danger Will Robinson! Danger!"
and:
"Really! If you are fussing around with void *, just go home or at least back to your editor!"
I think the IT manager kept that as a vendor just because of the message (the SDK was meh, but also fun!).
- jimmaswell 3y agoNot much of a C programmer, what's the context around void* being a big deal?
- zer8k 3y agoVoid 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.
- Quekid5 3y agoIt really should be specified to specifically summon nasal demons, IMO.
- tyg13 3y agoYou'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.
- zer8k 3y agoYes 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.
- tedunangst 3y agovoid * 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 *.
- tdiff 3y agoHas any civilization been warped in already?
- prewett 3y agoNot to my knowledge, but there seems to have been a slow warping out of civilization in recent years.