Which Google style guide to use

209 views
Skip to first unread message

Václav Brožek

unread,
Oct 29, 2015, 11:50:46 AM10/29/15
to chromi...@chromium.org
Hi all,

Chromium's style guide links to Google's C++ style guide for further guidance. It uses the http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml link. It has been pointed out recently, that the public Google C++ guide actually moved to http://google.github.io/styleguide/cppguide.html.

Should we update Chromium's style guide to point to http://google.github.io/styleguide/cppguide.html?

Note that the two versions of the Google C++ style guide differ non-trivially. For example, the new Google C++ style guide considers forward declarations harmful (cf. the old one).

Cheers,
Vaclav

Nico Weber

unread,
Oct 29, 2015, 11:59:05 AM10/29/15
to va...@chromium.org, chromi...@chromium.org
Probably the new one, but this specific rule doesn't make sense for Chromium. (We've discussed this one at some point somewhere – can't find the thread right now, but I can try harder next week.) 

Jeremy Roman

unread,
Oct 29, 2015, 1:15:38 PM10/29/15
to Nico Weber, va...@chromium.org, chromi...@chromium.org
On Thu, Oct 29, 2015 at 11:57 AM, Nico Weber <tha...@chromium.org> wrote:
On Thu, Oct 29, 2015 at 8:49 AM, Václav Brožek <va...@chromium.org> wrote:
Hi all,

Chromium's style guide links to Google's C++ style guide for further guidance. It uses the http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml link. It has been pointed out recently, that the public Google C++ guide actually moved to http://google.github.io/styleguide/cppguide.html.

Should we update Chromium's style guide to point to http://google.github.io/styleguide/cppguide.html?

Note that the two versions of the Google C++ style guide differ non-trivially. For example, the new Google C++ style guide considers forward declarations harmful (cf. the old one).

Probably the new one,

+1: we've always tracked the latest version (svn trunk) of the public style guide, and I can't imagine why this would change just because it moved to github.

I'll update the link; someone can change it back if this is wrong for some reason.
 
but this specific rule doesn't make sense for Chromium. (We've discussed this one at some point somewhere – can't find the thread right now, but I can try harder next week.) 

--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev

Bartosz Fabianowski

unread,
Oct 29, 2015, 1:25:30 PM10/29/15
to jbr...@chromium.org, Nico Weber, va...@chromium.org, chromi...@chromium.org
On 10/29/2015 06:14 PM, Jeremy Roman wrote:

On Thu, Oct 29, 2015 at 11:57 AM, Nico Weber <tha...@chromium.org> wrote:
On Thu, Oct 29, 2015 at 8:49 AM, Václav Brožek <va...@chromium.org> wrote:
Hi all,

Chromium's style guide links to Google's C++ style guide for further guidance. It uses the http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml link. It has been pointed out recently, that the public Google C++ guide actually moved to http://google.github.io/styleguide/cppguide.html.

Should we update Chromium's style guide to point to http://google.github.io/styleguide/cppguide.html?

Note that the two versions of the Google C++ style guide differ non-trivially. For example, the new Google C++ style guide considers forward declarations harmful (cf. the old one).

Probably the new one,

+1: we've always tracked the latest version (svn trunk) of the public style guide, and I can't imagine why this would change just because it moved to github.

I'll update the link; someone can change it back if this is wrong for some reason.
 
but this specific rule doesn't make sense for Chromium. (We've discussed this one at some point somewhere – can't find the thread right now, but I can try harder next week.)

If we disagree with some of the rules in the new style guide (e.g. forward declarations), should we not update the Chromium-specific overlay style guide before switching to the newest Google style guide as a baseline?


--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev

--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-dev...@chromium.org.

Peter Kasting

unread,
Oct 29, 2015, 1:45:04 PM10/29/15
to Bartosz Fabianowski, Jeremy Roman, Nico Weber, vabr, chromi...@chromium.org
On Thu, Oct 29, 2015 at 10:24 AM, Bartosz Fabianowski <bar...@chromium.org> wrote:
On 10/29/2015 06:14 PM, Jeremy Roman wrote:
On Thu, Oct 29, 2015 at 11:57 AM, Nico Weber <tha...@chromium.org> wrote:
On Thu, Oct 29, 2015 at 8:49 AM, Václav Brožek <va...@chromium.org> wrote:
Hi all,

Chromium's style guide links to Google's C++ style guide for further guidance. It uses the http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml link. It has been pointed out recently, that the public Google C++ guide actually moved to http://google.github.io/styleguide/cppguide.html.

Should we update Chromium's style guide to point to http://google.github.io/styleguide/cppguide.html?

Note that the two versions of the Google C++ style guide differ non-trivially. For example, the new Google C++ style guide considers forward declarations harmful (cf. the old one).

Probably the new one,

+1: we've always tracked the latest version (svn trunk) of the public style guide, and I can't imagine why this would change just because it moved to github.

I'll update the link; someone can change it back if this is wrong for some reason.
 
but this specific rule doesn't make sense for Chromium. (We've discussed this one at some point somewhere – can't find the thread right now, but I can try harder next week.)

If we disagree with some of the rules in the new style guide (e.g. forward declarations), should we not update the Chromium-specific overlay style guide before switching to the newest Google style guide as a baseline?

Updated (by mostly moving the section about this from the Dos And Don'ts page).

PK

Mark Mentovai

unread,
Oct 29, 2015, 5:32:19 PM10/29/15
to va...@chromium.org, chromi...@chromium.org
Rather than risk further confusion, I turned all of the content at the old site (such as https://google-styleguide.googlecode.com/svn/trunk/cppguide.xml) into redirects to the new one (https://google.github.io/styleguide/cppguide.html)

--

Mike Frysinger

unread,
Oct 29, 2015, 5:48:11 PM10/29/15
to Mark Mentovai, va...@chromium.org, chromi...@chromium.org
thanks!  i updated all the CrOS docs i knew of to use the new github.io site.
-mike

Václav Brožek

unread,
Oct 30, 2015, 9:07:38 AM10/30/15
to Peter Kasting, Bartosz Fabianowski, Jeremy Roman, Nico Weber, chromi...@chromium.org
Thanks for the helpful responses and quick updates to the style guide.

On Thu, 29 Oct 2015 at 18:43 Peter Kasting <pkas...@chromium.org> wrote:
On Thu, Oct 29, 2015 at 10:24 AM, Bartosz Fabianowski <bar...@chromium.org> wrote:
On 10/29/2015 06:14 PM, Jeremy Roman wrote:
On Thu, Oct 29, 2015 at 11:57 AM, Nico Weber <tha...@chromium.org> wrote:
On Thu, Oct 29, 2015 at 8:49 AM, Václav Brožek <va...@chromium.org> wrote:
Hi all,

Chromium's style guide links to Google's C++ style guide for further guidance. It uses the http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml link. It has been pointed out recently, that the public Google C++ guide actually moved to http://google.github.io/styleguide/cppguide.html.

Should we update Chromium's style guide to point to http://google.github.io/styleguide/cppguide.html?

Note that the two versions of the Google C++ style guide differ non-trivially. For example, the new Google C++ style guide considers forward declarations harmful (cf. the old one).

Probably the new one,

+1: we've always tracked the latest version (svn trunk) of the public style guide, and I can't imagine why this would change just because it moved to github.

I'll update the link; someone can change it back if this is wrong for some reason.
 
but this specific rule doesn't make sense for Chromium. (We've discussed this one at some point somewhere – can't find the thread right now, but I can try harder next week.)
If you found that reference, I would appreciate a link, just for my education. (Tried to fish for it in chromium-dev, but no luck so far.)

Thanks!
Vaclav

Peter Kasting

unread,
Oct 30, 2015, 3:17:06 PM10/30/15
to Václav Brožek, Bartosz Fabianowski, Jeremy Roman, Nico Weber, chromi...@chromium.org
On Fri, Oct 30, 2015 at 6:05 AM, Václav Brožek <va...@chromium.org> wrote: 
but this specific rule doesn't make sense for Chromium. (We've discussed this one at some point somewhere – can't find the thread right now, but I can try harder next week.)
If you found that reference, I would appreciate a link, just for my education. (Tried to fish for it in chromium-dev, but no luck so far.)

It looks like it never made it to chromium-dev because the initial discussion happened privately between me, Nico, Jahn Abd-El-Malek, and Mike Pinkerton, at a point when the internal Google style guide changed to frown on forward decls but the public one hadn't yet been updated (so there was nothing public to respond to).

At that time the discussion went as follows:

<pkasting>

 The formal decision [to prefer #includes] applies to "entities defined in another project".  Within a single project, forward decls are presumably OK (at least in my memory of the relevant internal debate).

In Chromium, the pros about decreasing build times are more important in our builds (often on individual developer machines) than they are in [Google internally], while the maintenance costs don't seem to apply as strongly.  (Anecdotally, most #include-related issues I've encountered are due not to forward decl use but to not following Include-What-You-Use, which is hard to follow sans tooling.)  Therefore, I think we should treat Chromium as "one project", or at least all the pieces that aren't in third_party/, and thus continue to encourage forward-decls.

<jam>

sgtm. perhaps we should treat "all code in chrome repo" as one "project", and not forward declare across repos.

<thakis>

My take is that this is a good guideline if you know that you have a scalable, distributed build system – then the effect is only a higher load, not higher build times.

This isn't true for chrome ... so I think we probably don't want to follow this recommendation.

I want to look at the [list of problems with forward decls] again ... I'm guessing that the problematic areas can mostly be caught at compile time with things like https://code.google.com/p/chromium/codesearch#chromium/src/third_party/WebKit/Source/wtf/OwnPtrCommon.h&l=51, but of course one needs to remember to put these things into place.

I'm not aware of any bugs we've seen in chrome due to missing forward decls.

<pkasting>

Mike, ... here's the contents of the thread I started to [discuss] this.   In short, I think we should ... not [apply] the forward decls-vs.-headers change; John and Nico seem to agree.

<pinkerton>

Awesome thanks, makes sense to me.

PK

Yuri Wiitala

unread,
Nov 3, 2015, 2:55:11 PM11/3/15
to Peter Kasting, Václav Brožek, Bartosz Fabianowski, Jeremy Roman, Nico Weber, chromi...@chromium.org
On Fri, Oct 30, 2015 at 12:15 PM, Peter Kasting <pkas...@chromium.org> wrote:
My take is that this is a good guideline if you know that you have a scalable, distributed build system – then the effect is only a higher load, not higher build times.

This isn't true for chrome ... so I think we probably don't want to follow this recommendation.

THIS.  For all the cons listed in the Google C++ Style Guide, the benefits from using forward decls far outweighs those risks, IMO, in these situations:

1. You are a contributor who does not have access to a distributed build system.

2. You have access to a distributed build system, but are developing on a laptop w/ no internet connection (or low-bandwidth connection).

#2 is actually very common for me; and I'd really like to see us encourage techniques that improve single-system build times.

Václav Brožek

unread,
Nov 4, 2015, 10:44:52 AM11/4/15
to Mark Mentovai, chromi...@chromium.org
Hi Mark,

On Thu, 29 Oct 2015 at 22:31 Mark Mentovai <ma...@chromium.org> wrote:
Rather than risk further confusion, I turned all of the content at the old site (such as https://google-styleguide.googlecode.com/svn/trunk/cppguide.xml) into redirects to the new one (https://google.github.io/styleguide/cppguide.html)

Thanks!
However, this unfortunately broke the links at http://chromium-cpp.appspot.com/ (the redirect apparently drops the fragment identifier).

Who owns http://chromium-cpp.appspot.com/? Could the style-guide links be changed to point to https://google.github.io/styleguide/cppguide.html, keeping the fragment identifiers?

Thanks!
Vaclav

Jeremy Roman

unread,
Nov 4, 2015, 10:55:13 AM11/4/15
to Vaclav Brozek, Mark Mentovai, chromi...@chromium.org
It's checked in at src/styleguide/c++/chromium-cpp/; send a CL to someone in styleguide/c++/OWNERS.

Jeremy Roman

unread,
Nov 4, 2015, 10:56:11 AM11/4/15
to Vaclav Brozek, Mark Mentovai, chromi...@chromium.org
(More specifically, styleguide/c++/c++11.html.)

Václav Brožek

unread,
Nov 12, 2015, 9:19:55 AM11/12/15
to Jeremy Roman, Mark Mentovai, chromi...@chromium.org
Thanks for the pointer! Done in https://codereview.chromium.org/1434123003/.

Cheers,
Vaclav
Reply all
Reply to author
Forward
0 new messages