------- Comment #6 from gdr at integrable-solutions dot net  2007-01-10 03:32 
-------
Subject: Re:  SIGSEGV in valarray::cshift(n) on empty array

"chris at bubblescope dot net" <[EMAIL PROTECTED]> writes:

| The standard refers to "(l+n)%size()", so if size()=0, that seems to be
| undefined. On the other hand, it seems fairly obvious what should happen in
| this case (ie nothing).

On the other other hand [semi ;-)], even without resorting to
undefinedness of "% size()", it takes a special rule to define the
cyclic rotation of nothing.  I don't see that special rule, which is
why I asked why it was obvious that the result it well-defined.

| On an unrelated note, isn't there a another bug in the standard here, as it
| seems to be assuming that (-1)%n = (n-1) for positive n, which isn't required
| by the standard?

the "c" in "cshift" stands for "cyclic", and yes the standard should have
described the behviour in terms of cyclic permutation instead of
showing an implementation.

-- Gaby


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30416

Reply via email to