Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!uwvax!tank!mimsy!chris From: chris@mimsy.UUCP (Chris Torek) Newsgroups: comp.unix.questions Subject: Re: void *a Message-ID: <17794@mimsy.UUCP> Date: 31 May 89 00:26:30 GMT References: <5197@rpi.edu> Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 29 In article <5197@rpi.edu> kyriazis@rpics (George Kyriazis) writes: > void *pt; >... The compiler complains that 'pt' is not defined, on ANY system I tried >it except the SUN. What's so special about suns and/or void * ??? The systems you tried must be using a version of PCC (`Portable C Compiler'). PCC, like many compilers for many languages, keeps track not only of declared variables but also of undeclared variables, and emits an error only on the first use: main() { i = 10; /* gets an error */ i++; /* says nothing */ j++; /* gets an error */ j = i; /* says nothing */ } Through some oversight, when `void' was added to PCC, someone used a type-code number that, combined with `pointer to', matched the special value for `undeclared variable': `void *p' enters p into the symbol table as a `complain about this undeclared variable' name.% This bug is fixed in modern PCCs, including the ones on current Berkeley tapes. ----- % This is not exactly right, but is close enough for explanatory purposes.... -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163) Domain: chris@mimsy.umd.edu Path: uunet!mimsy!chris