Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site brl-tgr.ARPA Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!godot!harvard!seismo!brl-tgr!tgr!cottrell@nbs-vms.ARPA From: cottrell@nbs-vms.ARPA Newsgroups: net.lang.c Subject: subject Message-ID: <8356@brl-tgr.ARPA> Date: Wed, 20-Feb-85 15:21:03 EST Article-I.D.: brl-tgr.8356 Posted: Wed Feb 20 15:21:03 1985 Date-Received: Tue, 26-Feb-85 05:13:29 EST Sender: news@brl-tgr.ARPA Organization: Ballistic Research Lab Lines: 71 /* Jon Mauney writes... > COMMENT > I will refrain from pointing out that the given example uv type punning > in C (doubly linked lists) is really a kludge to get abstract types > and jeneric funkshuns in a languaj that doesn't support them. I guess. The example I gave seems to work pretty well, & even seems readable. I always use typedefs and NEVER do the words int, long, char, struct, etc appear anywhere except typedefs (or if I'm lazy). The abstract type manipulation of links, heads, is well defined and isolated. With a few casts, even Doug, Guy, & Joe should be pleased. > However I cannot refrain from pointing out yet another piece uv > empirical evidens to show that the C languaj and its tradishuns > encouraj the writing uv unreadable code. To wit, the funkshun > > > LINKP insque(LINKP p,LINKP q); /* insert p after q */ > > { if (p) (((p->fwd = q->fwd)->bwd = p)->bwd = q)->fwd = p; > > return(p); > > } > > Okay, I'll reveal my true colors! I'm a fan of terseness. To the max. Gag me with verbosity. I like APL, & TECO. The less chars in a program the better! With sufficient mnemonic choices, one char will often suffice. Knuth always used 'p' & 'q' for nodes. One of the distinguishing features of C (relative to general purpose languages, not weird/neat ones like APL & LISP which also have this feature) is that the assignment operator returns a value which can then be acted upon as an expression. This isolated, debugged funxion stands as a testament to the power of the language and virtuosity of the coder without getting in the way of higher level fns where clarity is more important. It's a primitive. Make those fns short tho. > I also won't say anything about imajinativ speling. > TNEMMOC BTW, `language' is misspelled `langwij'. I like the letter X. It usually makes words shorter. In short, like to have FUN in what I do. I make up my own rules. Some of them are pretty good. You know what I mean. Doug Gwyn writes... > Now, that's not fair! Cottrell (the guy whose example you used) has > been railing against the very things that those of us who appreciate > readable, portable code like. Only portable, Doug. I like readability. I have my own stds tho. While some would call by style cryptic because of its terseness, excess verbosity can obscure the meaning as well. My goal is to modularize & format code so that the meaning is obvious `by inspexion'. That's my GOAL, not always the RESULT! Axually, my code is relatively portable as well, but only to `regular architectures'. Axually, the world IS looking more & more like a VAX as time goes by. You must remember this... How about a compromise? I'll write non-portable (in the abolute sense) code, but run it thru lint and clean it up before poting to net.sources. > I could show you worse examples in > almost any language you name. One can't solve these problems through > language design alone. > There is a serious effort underway to (a) improve the C language, and > (b) establish new traditions for its effective use. We hope that the > average quality of C code will improve as a result. I don't know whether to thank you for defending me or be offended. jim */