Pointer to data member address

前端 未结 6 1946
挽巷
挽巷 2021-01-02 23:59

I have read (Inside C++ object model) that address of pointer to data member in C++ is the offset of data member plus 1?
I am trying this on VC++ 2005 but i am not getti

6条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-03 00:26

    I have read that address of pointer to data member in C++ is the offset of data member plus 1?

    I have never heard that, and your own empirical evidence shows it's not the case. I think you misunderstood an odd property of structs & class in C++. If they are completely empty, they nevertheless have a size of 1 (so that each element of an array of them has a unique address)

提交回复
热议问题