Null pointer in __vptr

frame frame86 at live.com
Sat Nov 20 15:19:46 UTC 2021


On Friday, 19 November 2021 at 21:09:16 UTC, Ali Çehreli wrote:

> I am not sure that's correct. The way I picture it, the code 
> reaches the __vptr by following a pointer; so it's already 
> known. Additionally, I am under the impression that there is 
> only one __vptr for a given type, which all class objects of 
> that type point to.

I think this is true for an object instance. But from an 
interface instance, the object instance must be accessible 
somewhere? This is also how I would read the doc:

> The vtbl[0] entry is a pointer to the corresponding instance of 
> the object.Interface class.

On the other hand, I don't know what the debugger is really 
showing here - it's printed as void* array and I wonder where it 
gets the length of the array.


More information about the Digitalmars-d-learn mailing list