low level optimization
Dan Bernstein
brnstnd at kramden.acf.nyu.edu
Fri Apr 19 17:22:50 AEST 1991
In article <21815 at lanl.gov> jlg at cochiti.lanl.gov (Jim Giles) writes:
> You can tell me that until you are blue in the face. I have never seen
> any of these hypothetical contexts in which anonymous pointer arguments
> passed in as parameters can be safely assumed not to be aliased.
> Please give an example.
(``Anonymous pointer arguments''?)
sort(table,records,n)
int *table;
struct blah *records;
int n;
This routine sorts n records, setting table[i] to the position of the
i'th smallest record. This is, in fact, a very common type of sort,
hardly a ``hypothetical'' or contrived example. I recommend that you
read Knuth to learn about sorting and its many applications.
Since neither ``int'' nor ``struct blah'' is ``char'' or ``void'', a
standard compiler may assume that the pointers are not aliased.
(I don't expect Jim to respond to this article; he always ignores
counterexamples.)
---Dan
More information about the Comp.lang.c
mailing list