Declarations and defaulting in C

west at sdcsla.UUCP west at sdcsla.UUCP
Sun Jul 8 09:40:07 AEST 1984


Sure, you may break a few users' programs by dis-allowing things like:

	{ a; int c; b = 5; foo() /* call or decl? */; ...}

but people who write code in that manner probably haven't given
a thought to portability.   That is, the programs you'll break
by changing the language on this point are not likely to be
large, critical, or widely-used.   And the breakage is easily
fixed, assuming reasonable error messages are produced.

On the other hand, by allowing that sort of garbage to persist,
people who inadvertently make a mistake which ends up looking
like that will (perhaps) spend hours/days trying to figure out
what's wrong.

Why bother to standardize to a poor standard?   Why not, at this
extremely opportune time, push for a minor, easily-implemented improvement
for which everyone will be grateful later on?

---

The other point which bothers me, even more, is the limitation of
six significant characters in external names.   It seems to me that
the cost of converting a few linkers from 6 characters to some
larger number (say, 16 -- even 10 or 12 would be a vast improvement)
is much less than the cost of having programmers figure out
meaningful six-character names to use.   There aren't really that
many informative identifiers with six characters -- maybe a few
hundred at most.   Add to the cost of figuring out a group of
6-character identifiers (also not conflicting with any system
call or subroutine name) the cost of trying to decipher such
things.

And who really has 6-char-max linkers that they plan to support,
unchanged, for the next ten years?   I've never come accross any.

---

Finally, a suggestion.   Instead of allowing varargs function
declarations like this:		int oof( char *, );
how about using ellipses:	int oog( char * ... );
or perhaps:			int oog( char *, ... );
This also has the benefit that:	int oog( ... );
looks more natural than:	int oof( void, );

Purely a matter of style.

Thanks	-- Larry West, UC San Diego, Institute for Cognitive Science
	-- decvax!ittvax!dcdwest!sdcsvax!sdcsla!west
	-- ucbvax!sdcsvax!sdcsla!west
	-- west at NPRDC



More information about the Comp.lang.c mailing list