RESOLVED FIXED 39663
Update the style guide re: static member variables and structs
https://bugs.webkit.org/show_bug.cgi?id=39663
Summary Update the style guide re: static member variables and structs
Jeremy Orlow
Reported 2010-05-25 02:07:19 PDT
Update the style guide re: static member variables and structs
Attachments
Patch (2.07 KB, patch)
2010-05-25 02:14 PDT, Jeremy Orlow
no flags
Patch (1.59 KB, patch)
2010-05-26 03:45 PDT, Jeremy Orlow
no flags
Patch (1.59 KB, patch)
2010-05-27 06:23 PDT, Jeremy Orlow
darin: review+
Jeremy Orlow
Comment 1 2010-05-25 02:14:37 PDT
Darin Adler
Comment 2 2010-05-25 08:55:15 PDT
Comment on attachment 56995 [details] Patch > -<li>Prefix C++ data members with "m_". > +<li>Prefix C++ class member variables with "m_" and do not make them public. The term "data members" is correct C++ terminology. The term "member variables" is not correct C++ terminology. I would write: Prefix C++ data members with "m_" and static data members with "s_" and do not make them public > +<li>Static member variables should be prefixed with "s_".</li> The correct term is "static data members".
Jeremy Orlow
Comment 3 2010-05-25 09:09:41 PDT
(In reply to comment #2) > (From update of attachment 56995 [details]) > > -<li>Prefix C++ data members with "m_". > > +<li>Prefix C++ class member variables with "m_" and do not make them public. > > The term "data members" is correct C++ terminology. The term "member variables" is not correct C++ terminology. I would write: > > Prefix C++ data members with "m_" and static data members with "s_" and do not make them public Does "C++ data member" imply class (vs. structs)? Even if so, I think we should explicitly explain that public data members are OK with structs but not classes. > > +<li>Static member variables should be prefixed with "s_".</li> > > The correct term is "static data members". I will delete this and mention it above instead.
Kent Tamura
Comment 4 2010-05-26 03:20:51 PDT
(In reply to comment #3) > Does "C++ data member" imply class (vs. structs)? Even if so, I think we should explicitly explain that public data members are OK with structs but not classes. "data member" is used for structs too in the standard.
Jeremy Orlow
Comment 5 2010-05-26 03:45:04 PDT
Darin Adler
Comment 6 2010-05-26 10:49:47 PDT
Comment on attachment 57088 [details] Patch > -<li>Prefix C++ data members with "m_". > +<li>All data members in C++ classes must be private. Static data members should be prefixed by "s_". All other data members should be prefixed by "m_". Why the "must" vs. "should" here? I don’t think we need the word “All”.
Jeremy Orlow
Comment 7 2010-05-27 06:23:18 PDT
Jeremy Orlow
Comment 8 2010-05-28 02:02:15 PDT
Note You need to log in before you can comment on or make changes to this bug.