Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site avsdS.UUCP Path: utzoo!watmath!clyde!burl!ulysses!mhuxr!mhuxn!ihnp4!qantel!hplabs!hpda!fortune!dsd!avsdS!tooch From: tooch@avsdS.UUCP (Michael J. Tuciarone) Newsgroups: net.lang.c Subject: Re: C programming style Message-ID: <74@avsdS.UUCP> Date: Wed, 17-Jul-85 14:36:15 EDT Article-I.D.: avsdS.74 Posted: Wed Jul 17 14:36:15 1985 Date-Received: Fri, 19-Jul-85 03:02:29 EDT References: <11434@brl-tgr.ARPA> <303@ur-laser.uucp> <186@drivax.UUCP> Organization: Ampex Audio-Video Engineering, Redwood City, CA Lines: 61 Awww, c'mon folks. This whole discussion has become become silly enough without it degenerating into flames concerning "professionalism" and so forth. If you're reading this, someone is sufficiently convinced of your qualifications that they gave you a computer account. (Or at least you know enough not to break things.) If you can *write* to the net, you are able to wade through Unix [tm blah blah] do- cumentation and operate the system and programs...de facto, not a rank amateur. Regardless, this is not net.flame. Let's try to have a little professional courtesy and keep it clean, ok? And about "style" and "idiom"...Computer languages are generally designed to either fit a particular application (e.g. C, Forth, Ada) or demonstrate a principle (e.g., Pascal, APL, Lisp). Easy, easy, flames off. The utility of a language is inseparable from its features and syntax, which in turn are wholly dependent on the underlying design concept. With respect to C, the very first sentence in "The C Programmer's Manual" (you all *do* have a copy of K&R, don't you?) reads, "C is a general-purpose programming language which features economy of expression, modern control flow and data structures, and a rich set of operators." Increment and decrement operators, conditional expressions, and returned values from assignment statements are not just a part of C, they are accepted and preferred usage. One of the great vir- tues of C is its (potential) brevity and elegance; "economy of expression" is a design goal of the language! The conscientious programmer, like any skilled craftsman, will eschew opaque or in- comprehensible constructions. But idioms such as: char buf[80], *cp = buf; while ( (*cp++ = getchar()) != '0 ) ; are common, short, and understandable at a glance to the program- mer. Phrases like the above are the heart of C. I moved to C from Pascal and never looked back, if only because I could finally fit the whole function on one screen. There is, in any language, a certain overhead involved in learn- ing the language and its idioms. But all living languages will develop their own shorthand and common expressions. Good program- mers, like users of *any* language, will note the expressions in common use, and further those that are elegant, simple, and ex- pressive while avoiding the unclear and confusing. C may never approach Pascal for sheer readability, but the trade- off made in favor of brevity and richness of expression seems well worth the small extra effort invested in learning to speak the language well. Hoping you're still awake, Mike Tuciarone ...{hplabs, ucbvax}!atd!tooch@avsdS Audio/Video Systems Division Ampex Corporation "One of the [Allied-]Signal Companies"