[comp.lang.c] void * ?

bobc@attctc.Dallas.TX.US (Bob Calbridge) (01/10/90)

All right. I've seen this a number of times in the lat few days so I'll
just have to ask.  In what instances does one use the cast (void *)?
This says to me that you have nothing pointing to something.  1/2 :-)

So edjicate me, s'il vous plait.
-- 
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
=    More stupid questions available on request from                          =
-     bobc@attctc                     Your humble servant (real humble)       -
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

throopw@sheol.UUCP (Wayne Throop) (01/11/90)

> From: bobc@attctc.Dallas.TX.US (Bob Calbridge)
> In what instances does one use the cast (void *)?
> This says to me that you have nothing pointing to something.  1/2 :-)

No, it says that you have something pointing to nothing.

Well...   *ACTually* it says you have something pointing to ANYthing.

The keyword "void" was first introduced to indicate that a function had
no return value, as in void foo();, and in this original context it
means, roughly, "nothing".  But X3J11, to avoid coining new keywords to
take care of these cases, recycled the void keyword to mean "an unknown
type" in the type (void *), and to mean "no arguments (as opposed to an
unknown number of arguments)" in the prototype foo(void). 

So, "void" can mean "nothing", "anything" or "zero", depending on context.

(  Note well that (void *) doesn't mean "an unknown type"... the void
   inside there means that.  The whole thing means "pointer to an unknown
   type."  )
--
Wayne Throop <backbone>!mcnc!rti!sheol!throopw or sheol!throopw@rti.rti.org