0

for two pieces of codes

for (loop) {
    ProtoType instance;
    // do something with instance;
}

/* --------------- */

ProtoType instance;
for (loop) {
    // do something with instance;
    instance.Clear();
}

I got core dump with the latter one. So what's the difference between these two pieces of codes? What does Prototype.Clear() really do?

artour
  • 1
  • The first version creates a new object each iteration and the second resets and reuses the same object for each iteration. It's impossible to say why your program is crashing without a [mcve] though. – Miles Budnek Jan 09 '20 at 04:22
  • thx, and sorry cuz the codebase is really large – artour Jan 09 '20 at 05:22

0 Answers0