#pragma
Chris Torek
chris at mimsy.umd.edu
Sun Dec 2 00:20:26 AEST 1990
In article <12570056 at hprsue.HP.COM> sue at hprsue.HP.COM (Sue Meloy) writes:
>The only safe thing is for all implementation-specific directives
>to be protected by ifdefs.
(sounds good to me)
>For example (no noalias diatribes, please!),
Why not? :-)
>do_something(int *vector1, int *vector2)
>#ifdef WHIZBANG_C
>#pragma noalias vector1,vector2
>#endif
I still think `noalias' is a horrible name. For those who want to
build compilers without automatic alias detection (which is, I admit,
both impossible in general and very slow in the usual possible cases),
I suggest the syntax
noninterfering(p1, p2, p3, ..., pn)
which means that stores through p1 do not `interfere' with indirection
through any of p2, p3, ..., pn; stores through p2 do not interfere with
indirection through p1, p3, ..., pn; ...; and stores through pn do not
intefere with indirection through p1, p2, ..., pn.
Note that this is a weaker restriction. It should probably be augmented
to take functions as well:
noninterfering(p1, munch)
would say that munch() never affects p1[i] for any legal i (and, equivalently,
that p1[i] never affects munch()).
With a special syntax (ick) this same declaration could declare a pointer
or function `pure':
noninterfering(sin, *) # sin(x) is a pure function
noninterfering(ptr, *) # ptr points to memory not affected by
# any other pointer or function
It is not clear how to indicate that second-level pointers are pure.
Something along the lines of
double **x;
#pragma noninterfering(x, x[*], *)
might declare that not only is x[i] `pure', but also x[i][j].
This syntax could almost certainly be improved.
Oh well, enough of this.
--
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 405 2750)
Domain: chris at cs.umd.edu Path: uunet!mimsy!chris
More information about the Comp.std.c
mailing list