Update style guide for C++.
Change-Id: Ib8c681e221837407d7ae2578699b8a3f3227c1b7
Reviewed-on: https://boringssl-review.googlesource.com/19785
Commit-Queue: Steven Valdez <svaldez@google.com>
Reviewed-by: Steven Valdez <svaldez@google.com>
CQ-Verified: CQ bot account: commit-bot@chromium.org <commit-bot@chromium.org>
diff --git a/STYLE.md b/STYLE.md
index 3c74b45..0a7aab0 100644
--- a/STYLE.md
+++ b/STYLE.md
@@ -31,10 +31,10 @@
allowed and preferred where possible. Note that the common `goto err` cleanup
pattern requires lifting some variable declarations.
-Comments should be `/* C-style */` for consistency.
+Comments should be `// C99-style` for consistency with C++.
-When declaration pointer types, `*` should be placed next to the variable
-name, not the type. So
+When declaring pointer types, `*` should be placed next to the variable name,
+not the type. So
uint8_t *ptr;
@@ -60,6 +60,19 @@
continue with `#define`.
+## libssl
+
+libssl was originally written in C but is being incrementally rewritten in
+C++11. As of writing, much of the style matches our C conventions rather than
+Google C++. Additionally, libssl on Linux currently may not depend on the C++
+runtime. See the C++ utilities in `ssl/internal.h` for replacements for
+problematic C++ constructs. The `util/check_imported_libraries.go` script may be
+used with a shared library build to check if a new construct is okay.
+
+If unsure, match surrounding code. Discrepancies between it and Google C++ style
+will be fixed over time.
+
+
## Formatting
Single-statement blocks are not allowed. All conditions and loops must
diff --git a/ssl/internal.h b/ssl/internal.h
index 7aefff2..1140c92 100644
--- a/ssl/internal.h
+++ b/ssl/internal.h
@@ -221,7 +221,7 @@
#define HAS_VIRTUAL_DESTRUCTOR
#define PURE_VIRTUAL = 0
#else
-// HAS_VIRTUAL_DESTRUCTOR should be declared in any base clas ~s which defines a
+// HAS_VIRTUAL_DESTRUCTOR should be declared in any base class which defines a
// virtual destructor. This avoids a dependency on |_ZdlPv| and prevents the
// class from being used with |delete|.
#define HAS_VIRTUAL_DESTRUCTOR \