As has been explained, void came from Algol 68 via Steve Bourne.
As no object could be declared void, void* was a useless
construct. A kind of variable that could point to any object
was required to state the type of useful functions like qsort.
To avoid proliferation of keywords, the useless void* was
pressed into service. I do not remember who suggested that.
Doug
Show replies by date
I tried to post this once, but it doesn't seem to have worked.
Apologies if you see this twice...
Steve
--------------------------
Ok, here's my memory of void *, blurred as it may be by time.
Void was put into C, but it was actually not necessary by itself --
the default return type was int, and if nobody was using the value
there was no particular reason to use void. So only those who were
practitioners of the strong-type religion tended to use it. A major
problem in making C strongly typed was deciding on a return type for
malloc. It had traditionally returned char *, but this required a
cast to allow you to allocate things other than characters.
I was at a /usr/grp conference at the alcohol-fueled reception talking
to Charlie Roberts about the problems of making C more strongly
typed. The topic of malloc came up. All of a sudden Charlie got a
huge grin on his face and said "Hey! Why don't we have malloc return
void *". It took me a minute or two to even understand what void *
could possibly mean, but the idea was an instant winner. I seem to
recall it was done a week or two later. The idea may have simply
ready to be born and others may have had it as well, but this is what
I remember of it. And the experience sticks in my mind as being an
almost literal example of being "struck by an idea".
Steve
------------------------
----- Original Message -----
From:
"Doug McIlroy" <doug(a)cs.dartmouth.edu>
To:
<tuhs(a)minnie.tuhs.org>
Cc:
Sent:
Sun, 05 Nov 2017 19:37:16 -0500
Subject:
Re: [TUHS] origins of void*
As has been explained, void came from Algol 68 via Steve Bourne.
As no object could be declared void, void* was a useless
construct. A kind of variable that could point to any object
was required to state the type of useful functions like qsort.
To avoid proliferation of keywords, the useless void* was
pressed into service. I do not remember who suggested that.
Doug