Arch Robison's second argument:
> void foo( float * restrict p, float * restrict q ) {
> float * x = p;
> float * y = q;
> bar( p, q );
> bar( x, y );
> *p = *q;
> *x = *y;
> }
>
> The program is legal. ... However, if I change "restrict" to "const"
> (or "volatile") the example become illegal C++, because "const" and
> "volatile" cannot be implicitly cast away.
It's the pointer which carries the 'restrict' or 'const' attribute, not
the pointed-to value. Therefore your example, with 'restrict' replaced
with 'const', is legal C++. In fact the name mangling for
foo( float * const p, float * const q )
foo( float * p, float * q )
is the same. So, 'restrict' behaves much like 'const' because it expresses
a similar concept: both add constraints to what the function will be doing
with its arguments or add assumptions about what the function can assume
about its arguments.
Bruno
--------------------- Object Oriented Numerics List --------------------------
* To subscribe/unsubscribe: use the handy web form at
http://oonumerics.org/oon/
* If this doesn't work, please send a note to owner-oon-list@oonumerics.org
This archive was generated by hypermail 2b29 : Wed Feb 20 2002 - 03:20:12 EST