This is the mail archive of the gcc@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]

Re: signal 11 generating problem, was: Further observations regarding alloca on i586-pc-linux-gnu


Martin von Loewis <martin@mira.isdn.cs.tu-berlin.de> wrote:
> 
> > Yup, it's syntactically valid C++, but it is wrong because auto_ptr
> > will delete the pointer to the array as if it were a pointer to a
> > single object.  You should write auto_ptr_array instead.
> 
> Is auto_ptr_array a standard template? If so, where is it defined?

It is not in the standard, but it is widely recognized.  It's easy to make
your own.  Grab the auto_ptr source.  Search and replace "auto_ptr" with
"auto_ptr_array".  Then find the deletes and change each to delete [].
For bonus points, you can take an extra minute and add an operator [] to
make it look more like a C-style array.


-- 
Sol Foster: colomon@ralf.org

This may sting a little, just at first, but don't worry, that'll go away
once the searing pain kicks in. 
                                        -Ethan


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