Re: Error on deleting pointer
Re: Error on deleting pointer
- Subject: Re: Error on deleting pointer
- From: "Glenn L. Austin" <email@hidden>
- Date: Mon, 12 Sep 2011 20:33:20 -0700
Define a private copy constructor and private assignment operator and see if your program even compiles.
I'll bet that you have a copy somewhere that you're not aware of. If you have a bare pointer in a data structure, you'd better be declaring a copy constructor and assignment operator! On Sep 12, 2011, at 7:49 AM, Jos Timanta Tarigan wrote: Hi,
I seems not to understand what went wrong with my code. I use guard malloc and it catches this error when I delete the pointer in the destructor of an object.
~ObjectX() {
delete [] bgArr; // malloc error occured here
};
When I run it without guard malloc, the code runs, but the console prints the error. But when I try to simulate/reproduce it in a much smaller code, I cant reproduce the error. Its a little bit confusing.
I googled it and it seems like most result return an OSX/iOS/XCode related. Is there a chance that its a bug on XCode/Compiler? I'm using XCode 4.0 Snow Leopard with LLVM GCC 4.2.
-- Glenn L. Austin, Computer Wizard and Race Car Driver <>< "Where there's breath, there's hope!"
|
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden