Path: utzoo!attcan!uunet!wuarchive!cs.utexas.edu!yale!cmcl2!lanl!jlg From: jlg@lanl.gov (Jim Giles) Newsgroups: comp.lang.misc Subject: Re: C's sins of commission Message-ID: <65265@lanl.gov> Date: 9 Oct 90 23:13:01 GMT References: <14972@cbmvax.commodore.com> Organization: Los Alamos Natl Lab, Los Alamos, N.M. Lines: 20 From article <14972@cbmvax.commodore.com>, by skrenta@cbmvax.commodore.com (Rich Skrenta): > [...] Are the programs > any more readable because I say > int i; a[i] > to dereference instead of > struct foo *p; *p ? Yes! Because, a[i] and b[j] are guaranteed _not_ to be aliased. Whereas *p and *q might be or, then again, might not be. Further, the syntactic for (arrays in this example) will give some clue as to how the variables will be used. The pointer syatax _may_ be used to simulate arrays, but you might be planning to use it for dynamic memory, strings, recursive data structures, run-tim equivalencing, etc.. How does the reader know that the pointer will not be used in any of those ways - he knows the array won't be. Each of these features should have separate syntax since they are separate features. Forcing them all to masquerade as pointers only confuses the person maintaining the code - and doesn't give the compiler enough information to adequately optimize. J. Giles