catmanjoe720
Programmer
Sorry if this is a repost, but I need clarification.
Whenever you allocate memory with "new", you deallocate with "delete". According to MSDN, if delete is used without new, unpredictable results occur. does the same apply in the following pseudocode??? or in this case does the assignment operator act as "new"? (note assume the assignment operator for these Pointer objects has not been overloaded)
Pointer *Ptr;
Ptr = SomeList.Head() //returns a pointer object from a list
while (Ptr != 0)
{
If (some condition it true){
SomeList.remove(Ptr) //removes ptr from list
delete (ptr);
}
Ptr = SomeList.Next()
}
Whenever you allocate memory with "new", you deallocate with "delete". According to MSDN, if delete is used without new, unpredictable results occur. does the same apply in the following pseudocode??? or in this case does the assignment operator act as "new"? (note assume the assignment operator for these Pointer objects has not been overloaded)
Pointer *Ptr;
Ptr = SomeList.Head() //returns a pointer object from a list
while (Ptr != 0)
{
If (some condition it true){
SomeList.remove(Ptr) //removes ptr from list
delete (ptr);
}
Ptr = SomeList.Next()
}