void *a
Chris Torek
chris at mimsy.UUCP
Wed May 31 10:26:30 AEST 1989
In article <5197 at rpi.edu> kyriazis at 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 at mimsy.umd.edu Path: uunet!mimsy!chris
More information about the Comp.unix.questions
mailing list