This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libstdc++/29688] resize initializes whole array



------- Comment #4 from pcarlini at suse dot de  2006-11-03 00:08 -------
(In reply to comment #3)
> Subject: Re:  resize initializes whole array
> 
> There is no argument against the ISO standard, but to a non C/C++ programmer 
> it seems a waist of time to reallocate the array and initialize it when one 
> wants to add something to an array. Some other compilers will copy the 
> existing data into the newly allocated space which seems more in line with 
> the text book.

I don't know. We are definitely implementing the ISO C++ Standard, and, by the
way, many details in Stroustrup' books, predating the Standard, are know to be
slightly different. I will also add that valarray is *very* special - its
design was motivated by considerations of highest performance on superscalar
architectures, etc. - for example vector::resize behaves in a completely
different way, which probably you like better.

> The application will be changed to avoid the loss of data on a resize of 
> arrays, which is a better idea anyway. Thanks for the speedy reply.

For portability, that is the safe thing to do, yes, I agree.


-- 


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]