Timeline for Why can one initialize non-const and static const member variables but not static member variables?
Current License: CC BY-SA 3.0
4 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Oct 4, 2014 at 7:17 | comment | added | John Zwinck | @cdhowie: good point. Last time I tried something like that, I got an undefined symbol linking error, just as you would if you use a non-const one. But, if you never take its address or the moral equivalent, you may get away without defining the storage anywhere. I'm not making value judgements about whether you should, but on common platforms it seems you can. | |
Oct 4, 2014 at 6:37 | comment | added | cdhowie | "static const int: doesn't need to be stored" <-- This is not true. What if you take a pointer to a static const member? To what should the pointer point? | |
Oct 4, 2014 at 6:01 | vote | accept | Kam | ||
Oct 4, 2014 at 5:52 | history | answered | John Zwinck | CC BY-SA 3.0 |