Namespaces
Variants
Views
Actions

Difference between revisions of "Talk:cpp/language/attributes/deprecated"

From cppreference.com
Line 12: Line 12:
 
In addition, I 100% agree that "variable" generally includes static data members, but the standard does not always use it consistently that way. For instance, in [[https://eel.is/c++draft/dcl.init.list#note-1 list initialization]] it says that a variable can be list initialized but that clearly does not hold for static data members.
 
In addition, I 100% agree that "variable" generally includes static data members, but the standard does not always use it consistently that way. For instance, in [[https://eel.is/c++draft/dcl.init.list#note-1 list initialization]] it says that a variable can be list initialized but that clearly does not hold for static data members.
  
[[User:Hawkinsw|hawkinsw]] ([[User talk:Hawkinsw|talk]]) 11:01, 13 January 2024 (PST)hawkinsw
+
Update: Sorry! I will continue to think out loud here. In the previous example I specified, I see that they used the word "definition" and that is in distinction to declaration which resolves the conflict that I was seeing in an example such as https://godbolt.org/z/EMscssY6T.
 +
 
 +
I guess my overall question is, "If the authors meant it to apply to declarations of both static and non-static data members, why did they specifically add non-static data member to the list? Variable seems like it would have sufficed."
 +
 
 +
[[User:Hawkinsw|hawkinsw]] ([[User talk:Hawkinsw|talk]]) 12:55, 13 January 2024 (PST)hawkinsw

Revision as of 12:55, 13 January 2024

It looks like during the reformatting between [104386 and 104484], there was a typo introduced in where the [[deprecated]] attribute can appear. According to the standard, [[deprecated]] cannot appear in the declaration of a static data member.

Should this be corrected?

hawkinsw (talk) 23:44, 12 January 2024 (PST)hawkinsw

A static data member is a variable, and thus can have this attribute.
The standard says "a variable or a non-static data member" which is a bit misleading, but it actually does include static data members. --D41D8CD98F (talk) 00:19, 13 January 2024 (PST)

Thanks! The only reason I mention this is because there is a paper making its way through the committee that disagrees with that interpretation: [P2552]. I have emailed the author about the discrepancy.

In addition, I 100% agree that "variable" generally includes static data members, but the standard does not always use it consistently that way. For instance, in [list initialization] it says that a variable can be list initialized but that clearly does not hold for static data members.

Update: Sorry! I will continue to think out loud here. In the previous example I specified, I see that they used the word "definition" and that is in distinction to declaration which resolves the conflict that I was seeing in an example such as https://godbolt.org/z/EMscssY6T.

I guess my overall question is, "If the authors meant it to apply to declarations of both static and non-static data members, why did they specifically add non-static data member to the list? Variable seems like it would have sufficed."

hawkinsw (talk) 12:55, 13 January 2024 (PST)hawkinsw