c++ - Is printing of a member pointer to an int defined -
suppose have code:
#include <iostream> struct mine { int a; int b; }; int main() { int mine::* memberpointera = &mine::a; int mine::* memberpointerb = &mine::b; std::cout << memberpointera; std::cout << "\n"; std::cout << memberpointerb; }
when run microsoft visual c++ (2015)
i following output
1 1
the output expect more this:
1 2
so begs question: printing of member pointer defined behavior?
there's defined conversion pointer bool
. since member variable pointers not null
, evaluate true , print 1
.
Comments
Post a Comment