🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.misc
Article #1681

Re: C's sins of commission

#1681
From: Jim Giles
Date: Tue, 09 Oct 1990 23:13
20 lines
1402 bytes
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
Technical Details
Message-ID: <65265@lanl.gov>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!wuarchive!cs.utexas.edu!yale!cmcl2!lanl!jlg
References: <14972@cbmvax.commodore.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!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