Isn't a pointer just an address? Or I'm missing something?
I tested with several types of pointers:
- 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)
BUT pointers to member functions are bigger - 16B on my platform.
Three things:
- 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 that
void*must be able to "contain" any pointer type. In other words, any pointer must be able to be casted tovoid*, right? If so, then whysizeof( void* )is 8, whilesizeofa 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)?