From fb4e677da0aa57ed638ce4146915e9ce0d443995 Mon Sep 17 00:00:00 2001 From: Karl Wiberg Date: Mon, 4 Sep 2017 11:27:33 +0200 Subject: [PATCH] Style guide: Add text about C and non-compliant C++ code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit BUG=none NOTRY=true Change-Id: I64a64a4f138b6c8aa24ad2266284024d50163908 Reviewed-on: https://chromium-review.googlesource.com/648971 Reviewed-by: Niels Möller Commit-Queue: Karl Wiberg Cr-Commit-Position: refs/heads/master@{#19680} --- style-guide.md | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/style-guide.md b/style-guide.md index 6cf5f4589b..17e9fe9797 100644 --- a/style-guide.md +++ b/style-guide.md @@ -10,7 +10,27 @@ the exceptions in this file trump them both. [chr-style]: https://chromium.googlesource.com/chromium/src/+/master/styleguide/c++/c++.md [goog-style]: https://google.github.io/styleguide/cppguide.html +Some older parts of the code violate the style guide in various ways. + +* If making small changes to such code, follow the style guide when + it’s reasonable to do so, but in matters of formatting etc., it is + often better to be consistent with the surrounding code. +* If making large changes to such code, consider first cleaning it up + in a separate CL. + ### Exceptions There are no exceptions yet. If and when exceptions are adopted, -they'll be listed here. +they’ll be listed here. + +## C + +There’s a substantial chunk of legacy C code in WebRTC, and a lot of +it is old enough that it violates the parts of the C++ style guide +that also applies to C (naming etc.) for the simple reason that it +pre-dates the use of the current C++ style guide for this code base. + +* If making small changes to C code, mimic the style of the + surrounding code. +* If making large changes to C code, consider converting the whole + thing to C++ first.