My question is why sizeof(a_func_ptr) returns 16, while sizeof(func_ptr) returns 4 (as for any pointer on x86 system)?
Because pointer-to-members are implemented differently. They're not pointers under the hood. Some compilers, such as MSVC, implement them as struct
with more than one members in it.
Read this interesting article:
- Pointers to member functions are very strange animals
Note that in some compilers, they might have same size. The bottomline is: they're compiler-dependent.