libstdc++/2: valarray assignment operators don't resize

Gabriel Dos Reis dosreisATcmla.ens-cachan.fr
Tue Sep 14 06:17:00 GMT 1999


The following reply was made to PR libstdc++/2; it has been noted by GNATS.

From: Gabriel Dos Reis <dosreis@cmla.ens-cachan.fr>
To: Benjamin Kosnik <bkoz@cygnus.com>
Cc: rob@geonexuscorp.com, libstdc++-gnats@sourceware.cygnus.com,
        gdr@sourceware.cygnus.com
Subject: Re: libstdc++/2: valarray assignment operators don't resize
Date: 14 Sep 1999 15:07:53 +0200

 Benjamin Kosnik <bkoz@cygnus.com> writes:
 
 | > >Number:         2
 | > >Category:       libstdc++
 | > >Synopsis:       valarray assignment operators don't resize
 | > >Confidential:   no
 | > >Severity:       serious
 | > >Priority:       high
 | > >Responsible:    unassigned
 | > >State:          open
 | > >Class:          sw-bug
 | > >Submitter-Id:   net
 | > >Arrival-Date:   Mon Aug 23 20:47:00 PDT 1999
 | > >Closed-Date:
 | > >Last-Modified:
 | > >Originator:     Robert Campbell
 | > >Release:        2.90.6
 | > >Organization:
 | > >Environment:
 | > RedHat Linux 5.2 with glibc libraries	
 | > >Description:
 | > The various valarray<T>::operator=(...) methods do not
 | > resize the object as it should.  
 
 They don't have to.
 
   26.3.2.2 valarray assignment
   1  ... The resulting behaviour is undefined if the length of the
      argument array is not equal to the length of the *this array.
 
 Furthermore:
   
   26.3.2.6/3 If the array and the argument array do not have the same
   length, the behavior is undefined.
 
 
 I deliberately decided not to check array's length because valarrays
 are basic building blocks and valarray operations are intended to be
 primitive ones.  It is the user's responsability to check bound, in the
 same way he has to be cautious when deferencing pointer.
 
 -- Gaby


More information about the Libstdc++-prs mailing list