If you gaze long into an abyss, the abyss also gazes into you. --- Nietzsche
...but what about the void?
Let's look into the void together.
What do you see --- nothing or anything?
Same word. Different meanings. Different worlds.
void* = "anything" (actually unknown)It means: "This points to something... I just won't tell you what."
int x = 10;
void *ptr = &x;
That void*:
printf("%d", *(int*)ptr);
Which means:
Technically it's not "anything" --- it's just unknown.
void = nothingvoid myMethod() {
// returns nothing
}
No tricks. No guessing.
Just: "There is no value here."
Modern languages didn't remove power --- they moved responsibility:
How can the same word mean both?
void*)void)Same keyword. Different abstraction level.
C
void*--- a sealed box. You must label it yourself.Modern
void--- no box exists.
Honest question:
Do you ever miss void*... or are you happy letting the compiler carry that burden?