Re: Segfault with delete[] operator & virtually derived classes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



JP Mercury wrote:
On Mon, 07 Mar 2005 13:44:07 +0000, Nathan Sidwell wrote

JP Mercury wrote:


main() {
 A *list = new B[10];      // Allocate 10x derived, store first in A *list

Someone else made this comment too. But I am not treating 'list' like an array
of B's. For example, when I access the array I do:

you asked for an array of Bs, if you're not treating it as an array of Bs it's not gonna work.

Can you see other issues I might have overlooked?

Yes, you're lying to the compiler, and then kludging around the issue.

nathan

--
Nathan Sidwell    ::   http://www.codesourcery.com   ::     CodeSourcery LLC
nathan@xxxxxxxxxxxxxxxx    ::     http://www.planetfall.pwp.blueyonder.co.uk


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux