home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!cis.ohio-state.edu!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!ira.uka.de!math.fu-berlin.de!news.netmbx.de!Germany.EU.net!mcsun!sunic!psinntp!psinntp!dg-rtp!sheol!throopw
- From: throopw@sheol.UUCP (Wayne Throop)
- Newsgroups: comp.lang.c
- Subject: meanings of "void" keyword
- Message-ID: <721104887@sheol.UUCP>
- Date: 07 Nov 92 00:12:30 GMT
- References: <2214@sdrc.COM> <Bx8Cw8.5tB@portal.hq.videocart.com> <27264@dog.ee.lbl.gov>
- Lines: 51
-
- : From: torek@horse.ee.lbl.gov (Chris Torek)
- : Newsgroups: comp.lang.c
- : [...] `void' has two meanings in ANSI C:
- : - A void value is a value from the empty set. [...]
- : - A `pointer to (optionally qualified) void', or `void *', is
- : a `generic pointer' type [...]
-
- Um. I thought void had three meanings in ANSI C. The above two, and
-
- - A void prototype (eg: void f(void); )
- is an explicit declaration that f takes no arguments,
- introduced to a-void the ambiguity with the K&R
- meaning of an empty argument list.
-
- In fact, these three uses are essentially independent. The fact that
- (void*) and (void) are both in the type notation and the third is not
- make the two seem reasonable and related, but a "better" alternative
- would have been to render the three cases:
-
- (void)
- (any*)
- void f(empty);
-
- ... because the pointer case isn't really related to the "value drawn
- from the empty set" case. But by that time in the standards process,
- introduction of new keywords was something greatly to be avoided, so
- the "void" keyword was triply overloaded instead of introducing two
- more.
-
- ( I'd welcome comment from somebody who actually was part of the
- standards process for C... the above rumor is second or third
- hand. )
-
- ( Uh, mind you, the "void prototype" third usage isn't a rumor...
- I mean that the motivation for the triple overloading of void
- is a rumor that I have heard... )
-
- BTW: the "any" keyword would have been useful in argument lists
- and other places, apart from its use to coin the generic pointer.
-
- void f(int, any, any);
-
- could be used instead of
-
- void f(int, ...);
-
- to nail down the argument number, but leave the types generic.
- (generic by-value argument passing opens up a whole new can of worms,
- of course, but I'm sure the notion could be made to work in C.)
- --
- Wayne Throop ...!mcnc!dg-rtp!sheol!throopw
-