Inheritance and Memory Allocation

Inheritance and Memory Allocation

I can’t create an instance of the derived class using operator new. The base and the derived classes differ only by a virtual function. The error messages I receive at runtime asks me to specify the path for files like:

new.asm, strncpy.asm

You didn’t mention what compiler you’re using but it sounds like you’re attempting to step into the implementation code of operator new using Visual C++ debugger. Normally, you don’t need to do that. Simply use the “step over” command to exit from it. Instead, set a break point in constructor of the class whose instance you’re attempting to create.

You should note that many time-critical, low-level functions like memcpy, strncpy, memset etc. are written in assembly. When the compiler sees a call of such a function, it inserts its assembly code inline (rather than actually calling a function). When you try to step into the called function, the debugger needs to know where the assembly source files of these functions are located. You can find them in the Visual C++ installation CD (simply run a search to locate these files and then direct the debugger to look for them on the CD).


Share the Post: