Почему размер указателя на функцию отличается от размера указателя на функцию-член?
Разве указатель не является просто адресом? Или я что-то упустил?
Я тестировал несколько типов указателей:
pointers to any variables is the same (8B on my platform) pointers to functions are the same size, as pointers to variables (8B again) pointers to functions with different parameters - still the same (8B)НО указатели на функции-члены больше - 16B на моей платформе.
Три вещи:
Why are pointers to member functions bigger? What more information do they need? As far as I know, the standard says nothing about the size of a pointer, except thatvoid*
must be able to "contain" any pointer type. In other words, any pointer must be able to be casted to void*
, right? If so, then why sizeof( void* )
is 8, while sizeof
a pointer to member function is 16?
Are there any other examples for pointers, that are with different size (I mean, for standard platforms, not some rare and special ones)?