sibley (01/21/83)
In answer to why double a; b, c, d; is not flagged as an error: K&R p. 208 discusses implicit declarations and gives some examples, but does not say these examples are the only ones allowed. It is not entirely unreasonable that the above is an implicit declaration of b, c, and d as static int's (or auto int's if inside a function definition). This would require 4 bytes each on a VAX, as reportedly does happen. Perhaps the Ritchie compiler assumes them to be external, so does not allocate space or flag an error. However, the loader should complain about unresolved external references if this is the case. Dave Sibley Department of Mathematics Penn State University psuvax!sibley
ignatz (01/27/83)
in the 'bug' code:
double a;
b,
c,
d;
main()
{
a = b;
}
If you'll look at Kernighan & Ritchie's book, on page 204 (Section 10), it sez:
" A C program consists of a sequence of external definitions. An external
definition declares an identifier to have storage class 'extern' (by default)
or perhaps 'static', and a specified type. The type-specifier (8.2)
***may also be empty,in which case the type is taken to be 'int'.***"
(asterisks mine).
There it is, folks. You've got a legal, valid type declaration there.
Blech.
Dave Ihnat
ihuxx!ignatz
goldfarb (01/28/83)
Anyone for a new group: net.k&r.204??