Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!uunet!seismo!rochester!pt!ius2.cs.cmu.edu!edw
From: edw@ius2.cs.cmu.edu (Eddie Wyatt)
Newsgroups: comp.lang.c
Subject: Re: Writing readable code
Message-ID: <1232@ius2.cs.cmu.edu>
Date: Sun, 12-Jul-87 23:25:56 EDT
Article-I.D.: ius2.1232
Posted: Sun Jul 12 23:25:56 1987
Date-Received: Mon, 13-Jul-87 05:36:38 EDT
References: <1158@copper.TEK.COM> <6858@auspyr.UUCP> <17171@cca.CCA.COM> <228@amanue.UUCP>
Organization: Carnegie-Mellon University, CS/RI
Lines: 71

In article <228@amanue.UUCP>, jr@amanue.UUCP (Jim Rosenberg) writes:
> > 
> > 	c = getchar();
> > 	while (c != EOF)
> > 	    {
> > 	    .
> > 	    .
> > 	    .
> > 	    c = getchar();
> > 	    }
> > 
> 
> 
> I don't mean to flame you, but as it happens I believe your solution is
> dead wrong, on two counts.  (1) The two loops are *NOT EQUIVALENT*!  They
> may be equivalent to Pascal programmers, but they certainly are not to C
> programmers.  The reason is simply that in your version you must completely
> forego the use of the continue statement.  The fact that break and continue
> are missing from Pascal is a general class disaster, whereas the fact that
> they're present in C is a constant joy.  A continue statement inside your
> loop will obviously fail to reexecute getchar().  I suppose you could get
> around that as follows:
>
> (2) Once again I must protest that your version is really less clear.  Think
> about how *pseducode* for this loop might look:
> 
> 	while (the next character is not EOF) {
> 		.
> 		. do stuff with that character
> 		.
> 	}
> 
>  Jim Rosenberg
>      CIS: 71515,124                         decvax!idis! \
>      WELL: jer                                   allegra! ---- pitt!amanue!jr
>      BIX: jrosenberg                 seismo!cmcl2!cadre! /


    
   1) Next time, don't quote me out of context!!! I say I like

      while((c = getchar()) != EOF)

      over my proposed alternative.


    2) This posting was more in response to your absolutism "the alternative".


    3) The altered loop will work for all but "gotos" and "continues"
       Also the loop could be made to work with continues if one
       made the substitution "{ c = getchar(); continue; }" for
       "continue" (what a hack).

    4) I think you have missed the points others have been trying to make.

       o. Novices do have problems with the construct of assignments
	  in conditions.

       o. it deviates from the notion that expressions do not have side
	  effects.  (call it a Pascalism if you will).


 Final comment, read the f*ck*ng article and think before you post!!!!

-- 
					Eddie Wyatt

e-mail: edw@ius2.cs.cmu.edu

terrorist, cryptography, DES, drugs, cipher, secret, decode, NSA, CIA, NRO.