Timeline for "Invalid use of non-static data member" when initializing static member from global variable
Current License: CC BY-SA 4.0
19 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Mar 4, 2022 at 19:22 | audit | First answers | |||
Mar 4, 2022 at 19:22 | |||||
Mar 4, 2022 at 1:34 | audit | First answers | |||
Mar 4, 2022 at 1:34 | |||||
Mar 4, 2022 at 1:28 | audit | First answers | |||
Mar 4, 2022 at 3:13 | |||||
Feb 25, 2022 at 13:58 | audit | First answers | |||
Feb 25, 2022 at 13:58 | |||||
Feb 25, 2022 at 7:33 | audit | First answers | |||
Feb 25, 2022 at 8:08 | |||||
Feb 22, 2022 at 6:29 | audit | First answers | |||
Feb 22, 2022 at 6:29 | |||||
Feb 20, 2022 at 3:50 | audit | First answers | |||
Feb 20, 2022 at 3:50 | |||||
Feb 19, 2022 at 11:28 | audit | First answers | |||
Feb 19, 2022 at 12:25 | |||||
Feb 16, 2022 at 16:41 | comment | added | user904963 |
Probably best to use the scope operator to avoid an innocent-looking addition of a variable to A breaking the code.
|
|
Feb 16, 2022 at 15:52 | audit | First answers | |||
Feb 16, 2022 at 16:39 | |||||
Feb 14, 2022 at 18:14 | audit | First answers | |||
Feb 14, 2022 at 19:11 | |||||
Feb 11, 2022 at 17:42 | audit | First answers | |||
Feb 11, 2022 at 20:18 | |||||
Feb 8, 2022 at 5:06 | audit | First answers | |||
Feb 8, 2022 at 6:17 | |||||
Feb 7, 2022 at 22:54 | audit | First answers | |||
Feb 7, 2022 at 22:55 | |||||
Feb 7, 2022 at 19:20 | comment | added | Brian Bi | @Evg eel.is/c++draft/basic.scope.class#1 | |
Feb 7, 2022 at 19:19 | comment | added | Brian Bi |
I wouldn't call this a peculiar language quirk. Imagine if A::i were a function being defined out of line, rather than a static data member. You would expect that, inside the body of the function, x would refer to A::x . It's just that when the same thing happens in a static data member definition, it's a little bit surprising because we're not used to it.
|
|
Feb 7, 2022 at 13:57 | comment | added | Evg | Could you please give a reference to the standard? | |
Feb 7, 2022 at 11:45 | vote | accept | YuCL Lan | ||
Feb 7, 2022 at 10:07 | history | answered | molbdnilo | CC BY-SA 4.0 |