I had this code
const char* value = retCharPtrFunc();
Which had to be changed to:
const char* value;
if (true)
value = (retStringFunc()).c_str();
else
value = retCharPtrFunc();
And for some reason now this code is accessing more heap memory than before. Heap memory is for pointers (dynamic alloc.) and it doesn't look like I have added more memory than before, just changing the assignments.
Is there any difference how these code are interpreted and allocated memory?
signature of retCharPtrFunc()
const char* retCharPtrFunc() const;
string retStringFunc() const;
Aucun commentaire:
Enregistrer un commentaire