section 1.5.4: Word Counting

page 21

Deep sentence:

In a program as tiny as this, it makes little difference, but in larger programs, the increase in clarity is well worth the modest extra effort to write it this way from the beginning.
I agree with this. Some people complain that symbolic constants make a program harder to read, because you always have to look them up to see what they mean. As long as you choose appropriate names for symbolic constants and use them consistently (i.e. even if APPLE and ORANGE happen to have the same value, don't use one when you mean the other), no one will have this complaint about your programs.

Note that there's no direct way to simplify the condition

	if (c == ' ' || c == '\n' || c == '\t')
In particular, something like
	if (c == (' ' || '\n' || '\t'))
would not work. (What would it do?)


Read sequentially: prev next up top

This page by Steve Summit // Copyright 1995, 1996 // mail feedback