Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.3 4.3bsd-beta 6/6/85; site seismo.CSS.GOV
Path: utzoo!linus!gatech!seismo!keith
From: keith@seismo.CSS.GOV (Keith Bostic)
Newsgroups: net.lang.c
Subject: Re: C style
Message-ID: <309@seismo.CSS.GOV>
Date: Wed, 2-Oct-85 00:40:18 EDT
Article-I.D.: seismo.309
Posted: Wed Oct  2 00:40:18 1985
Date-Received: Wed, 2-Oct-85 21:21:50 EDT
Organization: Center for Seismic Studies, Arlington, VA
Lines: 29
Summary: Splitting code for readability isn't necessarily a good idea.

References: <1556@brl-tgr.ARPA> <139200011@uiucdcsb>

In article <139200011@uiucdcsb>, kenny@uiucdcsb.CS.UIUC.EDU writes:
> For Heaven's sake, the big problem with this code is that the conditional
> is quite unreadable in in-line code like this.  I'd prefer

	while (illegal (ch = getch()))
		beep ();
	addch (ch);
	refresh ();
	   ...
int illegal (ch)
 char ch;
 {
	return ((ch < 1 || ch > 5)
	     && ch != 'E');
 }

> which at least separates the test from the action.  I realize that it also
> moves the test further away physically in the code, but I think the price
> is worthwhile.

It may enhance readability, but it's not worthwhile.  You've just managed
to add a context switch per *character*.  Now, imagine what that's going to
do to a program like spell.  I'm not arguing that everything in the world
should be inline code, but there are still certain real-world limitations
even applications programmers should be aware of.

--keith