L
LewGun
Hi all:
Today, i read the source code of "cppunitlite", a obscure
problem come from the funciton: (the function reside in the
simplestring.cpp)
SimpleString SimpleString:perator= (const SimpleString&
other)
{
delete buffer; //???
buffer = new char [other.size() + 1];
strcpy(buffer, other.buffer);
return *this;
}
"buffer" is a instance of " char * ", so i want to know,the
statment "delete buffer", is it a ill statment? if not, why?
Today, i read the source code of "cppunitlite", a obscure
problem come from the funciton: (the function reside in the
simplestring.cpp)
SimpleString SimpleString:perator= (const SimpleString&
other)
{
delete buffer; //???
buffer = new char [other.size() + 1];
strcpy(buffer, other.buffer);
return *this;
}
"buffer" is a instance of " char * ", so i want to know,the
statment "delete buffer", is it a ill statment? if not, why?