Strange looping at end of function body call C++

前端 未结 1 1428
清歌不尽
清歌不尽 2021-01-22 12:22

I am writing a game program in C++ and have encountered an odd problem that seems to be unique to this function.

When this function is called, it executes just as expect

相关标签:
1条回答
  • 2021-01-22 13:00

    I would take any such behavior by a debugger with a grain of salt. Try adding a print statement inside the constructor. Most likely, you’ll find that it’s not getting called twice at all. Debuggers easily get confused about what source line they’re on.

    When in doubt, use assembly level stepping in the debugger (i.e. si / ni in gdb). That will remove any doubt what is truly executed.

    0 讨论(0)
提交回复
热议问题