↧
Answer by Brian Bi for Is accessing static class member via unitilialized...
The semantics of a->n are that *a is evaluated, but not accessed, since the data member is static. See C++17 [expr.ref]:... The postfix expression before the dot or arrow is evaluated ... The...
View ArticleIs accessing static class member via unitilialized pointer UB?
A follow-up question to this oneWe have the following code:#include <iostream>struct A { static int n;};int A::n = 5;int main() { A* a; //uninitialized on purpose std::cout << a->n;...
View Article
More Pages to Explore .....