The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
From: scj@yaccman.com (Steve Johnson)
Subject: [TUHS] origins of void*
Date: Sun, 05 Nov 2017 08:58:01 -0800	[thread overview]
Message-ID: <b9ee65e8fc48d75aac1d9b3247a950f445805cb7@webmail.yaccman.com> (raw)
In-Reply-To: <20171105154306.D325018C09D@mercury.lcs.mit.edu>

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 2552 bytes --]

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 it.  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 would require
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: "jnc@mercury.lcs.mit.edu (Noel" <Chiappa)>
To:<tuhs at minnie.tuhs.org>
Cc:<jnc at mercury.lcs.mit.edu>
Sent:Sun, 5 Nov 2017 10:43:06 -0500 (EST)
Subject:Re: [TUHS] origins of void*

 > From: Clem Cole

 > typing hard started to become more important in the kernel.

 I can imagine! The V6 kernel had all sorts of, ah, 'unusual' typing -
as I
 learned to my cost when I did that hack version of 'splice()' (to
allow a
 process in a pipline to drop out, and join the two pipes together
directly),
 which I did in V6 (my familiar kernel haunt).

 Since a lot of code does pointer math to generate wait 'channel'
numbers,
 e.g.:

 sleep(ip+2, PPIPE);

 when I naively (out of habit) tried to declare my pointers to be the
correct
 type, the math didn't work any more! ('ip', in this particular case,
was
 declared to be an 'int *'.)

 No doubt part of this was inherited from older versions (of the
system, and
 C); the code was working, and there was no call to tweak it. The lack
of
 casts/coercion in the V6 C compiler may have been an issue, too - I
had to do
 some equally odd things to make my splice() code work!

 Noel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://minnie.tuhs.org/pipermail/tuhs/attachments/20171105/dbf7817c/attachment.html>


  reply	other threads:[~2017-11-05 16:58 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-05 15:43 Noel Chiappa
2017-11-05 16:58 ` Steve Johnson [this message]
  -- strict thread matches above, loose matches on Subject: below --
2017-11-06  0:37 Doug McIlroy
2017-11-06  4:59 ` Steve Johnson
2017-11-04 10:19 Paul Ruizendaal
2017-11-05  9:48 ` Clem Cole
2017-11-05 10:06 ` arnold
2017-11-05 13:20   ` Ron Natalie
2017-11-05 15:14     ` Warner Losh
2017-11-05 17:53       ` Clem cole
2017-11-05 18:29         ` Steve Simon
2017-11-05 20:12           ` Clem cole
2017-11-05 21:08             ` Chet Ramey
2017-11-05 21:38               ` Clem cole
2017-11-05 21:53             ` Steve Simon
2017-11-05 20:44   ` Paul Ruizendaal
2017-11-05 21:06     ` Warner Losh
2017-11-06  7:24     ` arnold
2017-11-06 15:02       ` Warner Losh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b9ee65e8fc48d75aac1d9b3247a950f445805cb7@webmail.yaccman.com \
    --to=scj@yaccman.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).