Quantcast
Channel: Is accessing static class member via unitilialized pointer UB? - Stack Overflow
Browsing latest articles
Browse All 2 View Live

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 Article


Is 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
Browsing latest articles
Browse All 2 View Live




<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>