> Restrict never made it into the ISO/ANSI C++ standard. There is
> however this statement about valarray:
>
> 2 The valarray array classes are defined to be free of
> certain forms of aliasing, thus allowing operations
> on these classes to be optimized.
>
> I don't know of any compiler which makes use of this information.
I've never figured out what the "certain forms of aliasing" are that
would make valarray useful for optimization. Does anyone know?
For example, given:
void foo( std::valarray<float>& a, const std::valarray<float>& b ) {
a = 2*b;
}
I would love to know that a and b are distinct valarrays, but the standard
says nothing about that. If I don't know they are distinct, I need a temporary
vector for 2*b.
Valarray has always struck me as a misguided effort.
Certainly valarray permits some interesting optimization within valarray
expressions, but that part seems more related to knowing rules about the
sizes of the expression temporaries and is not really related to aliasing.
Arch D. Robison Kuck & Associates Inc.
robison@kai.com 1906 Fox Drive
217-356-2288 ext. 56 Champaign IL 61820
Lead Developer for KAI C++ http://www.kai.com/C_plus_plus/index.html
--------------------- 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:10 EST