aCC编译问题
void* pResult = NULL;
for(POSITION position = m_tree.GetRootPosition();
position != NULL;
m_tree.GetNext(position)
)
{
pResult = m_tree.GetAt(position);
if (pResult) {
delete pResult;
pResult = NULL;
}
}
用aCC编译时出现下列问题:
An object cannot be deleted using a pointer of type
'void * ' since the type of the object allocated is unknown. Either delete the object using the allocated
type or call operator delete directly.
delete pResult;
而用g++编译时不会有次问题出现,请问是什么原因,如何解决!谢谢!
^^^^^^^
[解决办法]
在这个问题上,显然aCC更好,如果result不是对象,你可以用free(result)来释放内存.
[解决办法]
第一个是因为类型未知,不能直接delete
aCC也有让人不习惯的地方,比如将char *s= "s ";的 "s "当作string类来存储
[解决办法]
还有它的库里边namespace std是不存在的