Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/5/84; site reed.UUCP Path: utzoo!linus!philabs!cmcl2!seismo!harvard!talcott!panda!genrad!decvax!tektronix!reed!alexis From: alexis@reed.UUCP (Alexis Dimitriadis) Newsgroups: net.lang.c Subject: Re: Re: C programming style Message-ID: <1710@reed.UUCP> Date: Sat, 20-Jul-85 22:50:56 EDT Article-I.D.: reed.1710 Posted: Sat Jul 20 22:50:56 1985 Date-Received: Wed, 24-Jul-85 20:02:06 EDT References: <11434@brl-tgr.ARPA> <480@mmintl.UUCP> <703@lll-crg.ARPA> Reply-To: alexis@reed.UUCP (Alexis Dimitriadis) Organization: Reed College, Portland, Oregon Lines: 61 > > I agree that "i++" is an abomination. > > The use of i++ when i+=1 will do is certainly an abomination! I personally > always use i+=1 when i just want to increment i but an not going to use > its value in that expression. For instance > > for(i = 0; i < DIM; i += 1) > > People ask me WHY? As it noted above everyone just uses i++. I realize comments like the above are coming from people who do not claim long experience with C, but why all the excitement? The meaning of foo++; in a statement by itself (the context in which increment operators were attacked) should be absolutely clear to anyone who knows what `++' does. Years of experience with kernel code are NOT required. `foo++;' is also terser than `foo += 1;' (or foo = foo + 1; !!!), and it's at least as unambiguous. The only blemish is, it doesn't _look_ like Pascal or FORTRAN. Now about things like while (*++ptr); It _does_ take effort to decipher just what they do, even if you know the language. _That_ is unclear, and so are things like if (foo = scanf("%f", &num) != 1 || num > 0) fubar(); comment(foo); that is, complex expressions without any parentheses to indicate what is actually happening, or (all too often), if the "professional" who wrote it intended it to happen. (There is a parenthesis error in our ctime(), for example). This kind of thing is unclear regardless of familiarity with the language. I do not agree that only "professionals" should use C, but there is nothing wrong with using basic features of the language in a simple way. I think it would be nice, in fact, if more people were familiar with "structured" languages like C and Pascal. (I wish the teaching of BASIC would be made into a Federal offense!) After all, the _big_ problems with C readability arise from use of its facilities in an obscure (e.g., unstructured) way, not from the choice of operators! Alexis Dimitriadis exit(errno ? (perror(argv[0]), errno) : 0); /*NOTREACHED*/ -- _______________________________________________ As soon as I get a full time job, the opinions expressed above will attach themselves to my employer, who will never be rid of them again. alexis @ reed ...teneron! \ ...seismo!ihnp4! - tektronix! - reed.UUCP ...decvax! /