Usage of "// static" comment before definitions of static member functions

31 views
Skip to first unread message

Tim Judkins

unread,
Apr 27, 2022, 7:29:36 PM4/27/22
to c...@chromium.org
This is a pattern I see very commonly in Chromium, but I don't see any specific guidance on it either in https://chromium.googlesource.com/chromium/src/+/master/styleguide/c++/c++.md or https://google.github.io/styleguide/cppguide.html

Do people have strong opinions and if so should we add explicit guidance?

Peter Kasting

unread,
Apr 27, 2022, 7:49:15 PM4/27/22
to Tim Judkins, cxx
My only opinion is that we should not add guidance.

PK

On Wed, Apr 27, 2022, 4:29 PM 'Tim Judkins' via cxx <c...@chromium.org> wrote:
This is a pattern I see very commonly in Chromium, but I don't see any specific guidance on it either in https://chromium.googlesource.com/chromium/src/+/master/styleguide/c++/c++.md or https://google.github.io/styleguide/cppguide.html

Do people have strong opinions and if so should we add explicit guidance?

--
You received this message because you are subscribed to the Google Groups "cxx" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cxx+uns...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/cxx/CALC37Vcv9m8JNnNp840H1R7EDeaQS3%3DTeFh8pgmUTxwWLRTsrw%40mail.gmail.com.

Ryan Hamilton

unread,
Apr 27, 2022, 7:51:59 PM4/27/22
to Peter Kasting, Tim Judkins, cxx
FWIW: there is google-internal (sorry! :<) advice against this convention in go/c-readability-advice#static-comments.

dan...@chromium.org

unread,
Apr 28, 2022, 10:03:25 AM4/28/22
to Ryan Hamilton, Peter Kasting, Tim Judkins, cxx
On Wed, Apr 27, 2022 at 7:52 PM Ryan Hamilton <r...@chromium.org> wrote:
FWIW: there is google-internal (sorry! :<) advice against this convention in go/c-readability-advice#static-comments.

Interesting. The discussion thread it links to didn't really go anywhere conclusive.
 

K. Moon

unread,
Apr 28, 2022, 12:45:37 PM4/28/22
to dan...@chromium.org, Ryan Hamilton, Peter Kasting, Tim Judkins, cxx
I think it's basically a consistency argument: be consistent with what's there already, and also, the majority of code doesn't do this, so you're more likely to be consistent if you don't add new uses. In a different code base, those trade-offs can be completely different. There aren't really strong technical arguments one way or the other.

Reply all
Reply to author
Forward
0 new messages