Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!seismo!gatech!bloom-beacon!husc6!mit-eddie!uw-beaver!uw-june!uw-entropy!dataio!pilchuck!rice From: rice@pilchuck.Data-IO.COM (Ken Rice) Newsgroups: comp.lang.c Subject: Re: Writing readable code Message-ID: <654@pilchuck.Data-IO.COM> Date: Fri, 10-Jul-87 11:42:13 EDT Article-I.D.: pilchuck.654 Posted: Fri Jul 10 11:42:13 1987 Date-Received: Sun, 12-Jul-87 11:57:29 EDT References: <1158@copper.TEK.COM> <6858@auspyr.UUCP> <17171@cca.CCA.COM> <1221@ius2.cs.cmu.edu> <228@amanue.UUCP> Reply-To: rice@pilchuck.Data-IO.COM (Ken Rice) Organization: Data I/O - FutureNet Corp.; Redmond, WA Lines: 38 Putting an assignment statement into a control statement like this while( c=test() != EOF ) ; Makes for readable code, I agree--but can play havoc with maintainability. If this code breaks, it's can be hard to single-step through this section and find out what "c" is after test() (depends upon your tools, of course). I often have to rewrite to separate things into visible parts for maintenance like was suggested c=test(); while(c!=EOF) { c=test(); } Now, I can see what's going on with my debugger. The problem is that, by changing the code, I may have broken it more. It's different now and, by definition, untested. Should I but it back? That risks breaking it too. Should I leave it? Should I have been a Forest Ranger? This is a case where one quality issue--readability--can reduce the level of another quality issue. Readability is my usual soapbox, until I run into this crap return(x=test()); Then, I want to kill. Let's write readable and MAINTAINABLE code; Code that we won't have to change to see how it works. If it reads well and fixes lousy, it's wrong. Ken Rice