Path: utzoo!attcan!uunet!samsung!zaphod.mps.ohio-state.edu!usc!chaph.usc.edu!alcor.usc.edu!jeenglis From: jeenglis@alcor.usc.edu (Joe English Muffin) Newsgroups: comp.lang.c Subject: Re: Seven Original Sins of K&R (Long) Message-ID: <12226@chaph.usc.edu> Date: 28 Sep 90 01:21:49 GMT References: <12780@sdcc6.ucsd.edu> Sender: news@chaph.usc.edu Organization: Joe's Homeopathic Hangover Remedies Lines: 38 Nntp-Posting-Host: alcor.usc.edu tom@ssd.csd.harris.com (Tom Horsley) writes: >The eight (and worst) original sin was allowing arrays to (sometimes) be >kind of automatically converted sort-of into pointers to the first element >of the array except when they aren't. C's array semantics make perfect sense once you understand C's *pointer* semantics, which are probably the most unique (and elegant, IMHO) feature of the language. The only wart I can see on the language wrt. arrays is that int foo(bar) char bar[]; { ... } is legal syntax. >Without a doubt this psuedo >equivalence between arrays and pointers that works most of the time except >when it doesn't has caused more confusion and twisted more brains of people >trying to learn C than any other feature. Actually, it's probably _strings_ that have boggled beginners with backgrounds in BASIC, causing confusion and core dumps, dismaying dozens of dumbfounded dopes, than anything else. How many times have *you* seen a C neophyte go nuts trying to figure out why 'string1 = strcat(string2,string3);' doesn't work as expected? Of course, strings make perfect sense too once you understand pointers. I hardly consider these things an 'original sin.' They're natural extensions of a fundamental part of the language, which is really quite simple to understand. --jeenglis@alcor.usc.edu