From ed11d7e04d9511efbbaad4221de1fbe9cea817df Mon Sep 17 00:00:00 2001 From: stuartmorgan Date: Tue, 13 Oct 2020 14:02:21 -0700 Subject: [PATCH 1/2] Add a style note about Linux embedding style While the files are C++, it doesn't follow usual C++ conventions, so should be called out explicitly. --- CONTRIBUTING.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 86c46f4b65e33..ebcd15f01b678 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -20,11 +20,17 @@ contributing guide. The Flutter engine follows Google style for the languages it uses: - [C++](https://google.github.io/styleguide/cppguide.html) + - **Note**: The Linux embedding generally follows idiomatic GObject-based C style. + Use of C++ is discouraged in that embedding to avoid creating hybrid code that + feels unfamiliar to either developers used to working with GObject or C++ developers. + E.g., do not use STL collections or std::string. Exceptions: + - C-style casts are forbidden; use C++ casts. + - Use `nullptr` rather than `NULL`. - [Objective-C](https://google.github.io/styleguide/objcguide.html) (including [Objective-C++](https://google.github.io/styleguide/objcguide.html#objective-c)) - [Java](https://google.github.io/styleguide/javaguide.html) -C++ and Objective-C/C++ files are formatted with `clang-format`, and GN files with `gn format`. +C/C++ and Objective-C/C++ files are formatted with `clang-format`, and GN files with `gn format`. [build_status]: https://cirrus-ci.com/github/flutter/engine [code_of_conduct]: https://github.com/flutter/flutter/blob/master/CODE_OF_CONDUCT.md From 1754628ec9da97e1cdea48d37bc012832e4a2aa6 Mon Sep 17 00:00:00 2001 From: stuartmorgan Date: Tue, 13 Oct 2020 14:21:39 -0700 Subject: [PATCH 2/2] Add a note about constexpr --- CONTRIBUTING.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ebcd15f01b678..4cd3c378af349 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -26,6 +26,7 @@ The Flutter engine follows Google style for the languages it uses: E.g., do not use STL collections or std::string. Exceptions: - C-style casts are forbidden; use C++ casts. - Use `nullptr` rather than `NULL`. + - Avoid `#define`; for internal constants use `static constexpr` instead. - [Objective-C](https://google.github.io/styleguide/objcguide.html) (including [Objective-C++](https://google.github.io/styleguide/objcguide.html#objective-c)) - [Java](https://google.github.io/styleguide/javaguide.html)