Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!uunet!seismo!mcnc!ece-csc!ncrcae!ncr-sd!hp-sdd!ucsdhub!jack!man!nu3b2!rwhite
From: rwhite@nu3b2.UUCP (Robert C. White Jr.)
Newsgroups: comp.lang.c
Subject: Re: Writing readable code
Message-ID: <797@nu3b2.UUCP>
Date: Sat, 11-Jul-87 04:32:31 EDT
Article-I.D.: nu3b2.797
Posted: Sat Jul 11 04:32:31 1987
Date-Received: Sun, 12-Jul-87 15:48:58 EDT
References: <1158@copper.TEK.COM> <6858@auspyr.UUCP> <17171@cca.CCA.COM> <654@pilchuck.Data-IO.COM>
Organization: National University, San Diego
Lines: 39
Summary: Expansion Rules.


I will not include the entire thing, but you ar correct to convert

while ((x = func()) == y) {...}
into
x = func()
while (x == y) {...; x = func();}
for debugging purposes.

To your question: "should I leave it that way?" I SAY NO.  The acceptability
of the expansion is required by most rules governing these things.  The
expanded version, however, may take MUCH more space when done on a
whole program.  In a sense, the structure [at object level] is poluted
by the extra call.  The entire code group, even durring debugging, is
more CONSICE and easy to deal with in the compresses form.  The aproach
to debugging the compressed form is actually easier when done from the
correct angle.  I may be a trick nobody ever explained, but the invocation
level and values expressed in the return statment are generally better
debugging points when they can be compared to the assigned-to variable's
value in the macro statment [it all gets displayed together].

The expansion should be saved for times when you are checking the algorythm
itself. [algorythm analisys should NEVER be done with a debugging tool
(there is a controversial opinion for you :-) because you will often take
value progression for granted, or miss a multi-path variant because you
couldn't massage the value correctly]  ALWAYS compress up-to but not as
far as the unreadability threshold.  You should be able to read the line
once and get the executition path the first time, if not the functional
behavior. (-: give the optomizer a break eh? ;-)

As if you really ever cared what I thought....		8-)

Robert.

Disclaimer:  My mind is so fragmented by random excursions into a
	wilderness of abstractions and incipient ideas that the
	practical purposes of the moment are often submerged in
	my consciousness and I don't know what I'm doing.
		[my employers certainly have no idea]