View Single Post
Old May 26th, 2006, 5:29 PM   #10
nnxion
Programming Guru
 
nnxion's Avatar
 
Join Date: Jun 2005
Location: elemental plane
Posts: 1,429
Rep Power: 5 nnxion is on a distinguished road
A side question: I see Soulstorm doing:
void stash::clearStash(){
	currentSize = 0;
	currentStorage = 0;
	ch = new char [0];
	next = currentStorage - currentSize;
}
So he doesn't delete [] anything, will new do a resize next time it's called (like realloc)?

So then the following would function correctly:
int main()
{
	char * ch = new char[5];
	ch = new char[30];
	ch = new char[1];
	delete [] ch;

	return 0;
}
__________________
"Employ your time in improving yourself by other men's writings, so that you shall gain easily what others have labored hard for."
-- Socrates
nnxion is offline   Reply With Quote