This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: valarray assignment
- To: Philip Charlton <charlton at ligo dot caltech dot edu>
- Subject: Re: valarray assignment
- From: Gabriel Dos Reis <gdr at codesourcery dot com>
- Date: 14 Oct 2001 18:32:22 +0200
- Cc: <libstdc++ at gcc dot gnu dot org>
- Organization: CodeSourcery, LLC
- References: <Pine.LNX.4.33.0110101124400.2472-100000@m90.ligo.caltech.edu>
Philip Charlton <charlton@ligo.caltech.edu> writes:
| what I was going to ask was, in valarray assignment it seems that no check
| for self-assignment is made, instead __valarray_copy() is called which
| immediately calls memcpy() to do the copying. Was this choice made
| for efficiency, to avoid the overhead of an "if" statement?
I've already replied to a private email from Philip. I'll make
another public answer here for future reference.
The library specification makes some form of non-aliasing and
parallelim assumptions; those includes non self-assignments.
-- Gaby
CodeSourcery, LLC http://www.codesourcery.com