aboutsummaryrefslogtreecommitdiff
path: root/flang/docs/C++style.md
diff options
context:
space:
mode:
Diffstat (limited to 'flang/docs/C++style.md')
-rw-r--r--flang/docs/C++style.md4
1 files changed, 3 insertions, 1 deletions
diff --git a/flang/docs/C++style.md b/flang/docs/C++style.md
index 0457913..cbb96f1 100644
--- a/flang/docs/C++style.md
+++ b/flang/docs/C++style.md
@@ -205,11 +205,13 @@ contents, and it is assumed that the contents are present, validate that
assumption by using `x.value()` instead.
1. We use `c_str()` rather than `data()` when converting a `std::string`
to a `const char *` when the result is expected to be NUL-terminated.
-1. Avoid explicit comparisions of pointers to `nullptr` and tests of
+1. Avoid explicit comparisons of pointers to `nullptr` and tests of
presence of `optional<>` values with `.has_value()` in the predicate
expressions of control flow statements, but prefer them to implicit
conversions to `bool` when initializing `bool` variables and arguments,
and to the use of the idiom `!!`.
+(But please use `.has_value()` or `.value_or()` with `optional<bool>`
+to avoid a common pitfall or the appearance of having fallen into it.)
#### Classes
1. Define POD structures with `struct`.