--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
Hi all,After we updated the default compiler on Linux to Clang, we are in a state that we can technically use C++11 features. However, we haven't declared a clearance on using C++11 features yet, if I recall correctly.Despite of that, we already have some code using C++11 features (such as enum-class style access for regular enums, and unordered_map<>) as I showed in the last email thread, intentionally or not, without a clear consensus on their uses.I believe people are using these features with a good intention, but the use of C++11 features without coordination sounds a little bit risky for the whole project. Many people are not very seasoned on C++11 features, I assume (including me), so I'd like to see a clear guidance on these features, in addition to the set of allowed C++11 features (either whitelist or blacklist), before we get too much code that depends on C++11 features inadvertently.
C++11 features may be used unless specified otherwise. In addition to what's described in the rest of the style guide, the following C++11 features may not be used:
- Functions with trailing return types, e.g. writing auto foo() -> int; instead of int foo();, because of a desire to preserve stylistic consistency with the many existing function declarations.
- Compile-time rational numbers (<ratio>), because of concerns that it's tied to a more template-heavy interface style.
- The <cfenv> and <fenv.h> headers, because many compilers do not support those features reliably.
- Lambda expressions, or the related std::function or std::bind utilities.
Unfortunately I'm not the right person to make the call, as I don't know much about C++11 features and cross-compiler compatibility, but I'm sure some folks in this list are. WDYT?Thanks,Yuta
--
Hi all,After we updated the default compiler on Linux to Clang, we are in a state that we can technically use C++11 features.
However, we haven't declared a clearance on using C++11 features yet, if I recall correctly.Despite of that, we already have some code using C++11 features (such as enum-class style access for regular enums, and unordered_map<>) as I showed in the last email thread, intentionally or not, without a clear consensus on their uses.
The Chromium C++ guide [http://www.chromium.org/developers/coding-style#TOC-C-11] has a brief stanza that "chromium does not yet allow most C++11 features" but doesn't really detail what those are.However, I do recall that 'auto' was (is?) being used on Mac, once we built with a modern-enough clang. It appears a few Windows-specific files use the auto keyword as well now (win8/metro_driver/metro_driver.cc, win8/metro_driver/metro_driver_win7.cc), soo it might be useful to clarify what is/isn't allowed on that page.
Hello,
Can anyone provide background on the rationale for the lambda rule? That was added some time ago to the style guide but I wondered whether thinking on the matter has changed within Google since then.
On Monday, 18 August 2014 09:18:33 UTC+1, Yuta Kitamura wrote:Hi all,After we updated the default compiler on Linux to Clang, we are in a state that we can technically use C++11 features. However, we haven't declared a clearance on using C++11 features yet, if I recall correctly.Despite of that, we already have some code using C++11 features (such as enum-class style access for regular enums, and unordered_map<>) as I showed in the last email thread, intentionally or not, without a clear consensus on their uses.I believe people are using these features with a good intention, but the use of C++11 features without coordination sounds a little bit risky for the whole project. Many people are not very seasoned on C++11 features, I assume (including me), so I'd like to see a clear guidance on these features, in addition to the set of allowed C++11 features (either whitelist or blacklist), before we get too much code that depends on C++11 features inadvertently.Unfortunately I'm not the right person to make the call, as I don't know much about C++11 features and cross-compiler compatibility, but I'm sure some folks in this list are. WDYT?Thanks,Yuta
--