Path: chuka.playstation.co.uk!news From: "Derek da Silva" Newsgroups: scee.yaroze.freetalk.english Subject: Codewarrior C++ Problem Date: Wed, 7 Mar 2001 15:15:58 -0000 Organization: PlayStation Net Yaroze (SCEE) Lines: 175 Message-ID: <985jdn$bmm4@www.netyaroze-europe.com> NNTP-Posting-Host: svr3-haw.cableinet.net Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_003E_01C0A719.83491640" X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 This is a multi-part message in MIME format. ------=_NextPart_000_003E_01C0A719.83491640 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi Can anyone tell me why the following program causes a : Machine Exception at 0x801ffec0 (or some similar value)? The above error only occurs when the destructor is declared as virtual. So, basically I can't allocate memory for objects with virtual = destructors - aargh. I can't upload anything to my site as the FTP LIST command doesn't seem = to be working (is FTP working for everyone else?), so I've attached this = simple project to another post in this thread so those who want to can = have a fiddle with it can do. Help! Cheers Derek da Silva //---------------------------------------- #include #include const int NUM_POINTS =3D 2; class gsCPoint { private: int x; int y; public: gsCPoint(); virtual ~gsCPoint(); }; gsCPoint::gsCPoint() { } gsCPoint::~gsCPoint() { } void quit(void); main() { gsCPoint *p; =20 p =3D new gsCPoint[NUM_POINTS]; =20 delete [] p; =20 p =3D new gsCPoint[NUM_POINTS]; printf("hello world"); quit(); } asm void quit(void) { breakc 0x8201 nop } //---------------------------------------- ------=_NextPart_000_003E_01C0A719.83491640 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Hi
 
Can anyone tell me why the following program causes a :
Machine Exception at 0x801ffec0 (or some similar value)?
 
The above error only occurs when the destructor is declared as = virtual.
So, basically I can't allocate memory for objects with virtual = destructors=20 - aargh.
 
I can't upload anything to my site as the FTP LIST command doesn't = seem to=20 be working (is FTP working for everyone else?), so I've attached this = simple=20 project to another post in this thread so those who want to can have a = fiddle=20 with it can do.  Help!
 
Cheers
Derek da Silva
 
//----------------------------------------<= /DIV>
 
#include=20 <libps.h>
#include=20 <stdio.h>
 
const = int NUM_POINTS =3D 2;
 
class=20 gsCPoint
{
    private
:
      &n= bsp; =20 int=20 x;
         int
y;
    public:
     =    =20 gsCPoint();
         virtual ~gsCPoint();
};
 
gsCPoint::gsCPoint()
{
}
 
gsCPoint::~gsCPoint()
{
}
 
void quit(void);
 
main()
{
    = gsCPoint=20 *p;
 
    p =3D new=20 gsCPoint[NUM_POINTS];
 
    delete
[] p;
 
    p = =3D new gsCPoint[NUM_POINTS];
 
    printf("hello=20 world");
 
    = quit();
}
 
asm void quit(void)
{
    breakc=20 0x8201
    nop
}
//----------------------------------------
------=_NextPart_000_003E_01C0A719.83491640--