The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
* [TUHS] origins of void*
@ 2017-11-06  0:37 Doug McIlroy
  2017-11-06  4:59 ` Steve Johnson
  0 siblings, 1 reply; 19+ messages in thread
From: Doug McIlroy @ 2017-11-06  0:37 UTC (permalink / raw)


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


^ permalink raw reply	[flat|nested] 19+ messages in thread
* [TUHS] origins of void*
@ 2017-11-05 15:43 Noel Chiappa
  2017-11-05 16:58 ` Steve Johnson
  0 siblings, 1 reply; 19+ messages in thread
From: Noel Chiappa @ 2017-11-05 15:43 UTC (permalink / raw)


    > 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


^ permalink raw reply	[flat|nested] 19+ messages in thread
* [TUHS] origins of void*
@ 2017-11-04 10:19 Paul Ruizendaal
  2017-11-05  9:48 ` Clem Cole
  2017-11-05 10:06 ` arnold
  0 siblings, 2 replies; 19+ messages in thread
From: Paul Ruizendaal @ 2017-11-04 10:19 UTC (permalink / raw)


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


I’m trying to understand the origins of void pointers in C. I think they first appeared formally in the C89 spec, but may have existed in earlier compilers.

Of course, as late as V7 there wasn’t much enforcement of types and hence no need for the void* concept and automatic casting. I suppose ‘lint’ would have flagged it though.

In the 4BSD era there was caddr_t, which I think was used for pretty much the same purposes. Did ‘lint’ in the 4BSD era complain about omitted casts to and fro’ caddr_t?

Background to my question is research into the evolution of the socket API in 4.1x BSD and the persistence of ‘struct sockaddr *’ in actual code, even though the design papers show an intent for ‘caddr_t’ (presumably with ‘void*’ semantics, but I’m not sure).

Paul



^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2017-11-06 15:02 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-06  0:37 [TUHS] origins of void* Doug McIlroy
2017-11-06  4:59 ` Steve Johnson
  -- strict thread matches above, loose matches on Subject: below --
2017-11-05 15:43 Noel Chiappa
2017-11-05 16:58 ` 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

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).