Re: Array of object from varius subclasses

From: Marco (hwddtr-nospam_at_tin.it)
Date: 12/14/03


Date: Sun, 14 Dec 2003 23:45:56 +0100

Hi,

Thank you for all your replies and the information!

Marco

"Bob Hairgrove" <wouldnt_you_like@to_know.com> ha scritto nel messaggio
news:3fdc468e.5684383@news.webshuttle.ch...
> On Sun, 14 Dec 2003 02:08:56 +0100, "Max M." <edgar@maxim.comm2000.it>
> wrote:
>
> >Thomas Wintschel wrote:
> >
> >> Note that Max made the change from an array of CPeople to an array of
> >> CPeople*. Without this change, inserting an object of a subclasss with
a
> >> larger size would corrupt your memory.
> >
> >Tom, this sentence doesn't make much sense. One cannot *insert* an object
> >into an array. Rather, one can use the assignment operator to change an
> >element's value. Marco's original code was perfectly legal and had well
> >defined behaviour, though different from what he expected.
>
> He was referring to slicing which, although it might not "corrupt"
> memory here, will indeed cause memory leaks.
>
>
> --
> Bob Hairgrove
> NoSpamPlease@Home.com



Relevant Pages

  • Overloading OPERATOR(+): my usage causing memory leaks.
    ... I apply it to array arguments. ... what in the code could be causing these memory leaks? ... end interface assignment ... elemental subroutine my_destroy ...
    (comp.lang.fortran)
  • Re: Solving overwrites/leaks
    ... it *does* have buffer underrun and overrun checking. ... declare an array of length 100 and write to the 101st position, ... > I've looked at the ENTREK software, and it does look like a good solution ... >> checking for memory leaks, tracking where they occurred, etc. ...
    (microsoft.public.windowsce.embedded.vc)
  • Re: new without delete: what will happen
    ... I remember when memory leaks were a problem; as Doug points out, ... >To clarify, I use new mainly for scalars that I store in smart pointers, ... >while std::vector takes the place of array new. ... MVP Tips: http://www.flounder.com/mvp_tips.htm ...
    (microsoft.public.vc.mfc)
  • Re: DEBUG_NEW in template class?
    ... I would move all the 'delete's to the wrapper class ... That is, remove all deletes from code, loop the array in the ... > I'm debugging memory leaks in an inherited application. ...
    (microsoft.public.vc.mfc)