[PATCH] D151187: [doc] Add casting style preference to coding standards
James Henderson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed May 24 00:30:30 PDT 2023
jhenderson updated this revision to Diff 525036.
jhenderson added a comment.
Add reference to `[[maybe_unused]]` and remove example.
I haven't put anything about functional-style casts at this point, but I'm happy to, if there's consensus one way or another (I feel like there isn't currently).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D151187/new/
https://reviews.llvm.org/D151187
Files:
llvm/docs/CodingStandards.rst
Index: llvm/docs/CodingStandards.rst
===================================================================
--- llvm/docs/CodingStandards.rst
+++ llvm/docs/CodingStandards.rst
@@ -1263,6 +1263,14 @@
bool NewToSet = Myset.insert(Value); (void)NewToSet;
assert(NewToSet && "The value shouldn't be in the set yet");
+Prefer C++-style casts
+^^^^^^^^^^^^^^^^^^^^^^
+
+When casting, use ``static_cast`` and ``reinterpret_cast`` rather than C-style
+casts. The sole exception to this is when casting to void to suppress warnings
+about unused variables (as an alternative to ``[[maybe_unused]]``), when C-style
+casts should be preferred instead.
+
Do Not Use ``using namespace std``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D151187.525036.patch
Type: text/x-patch
Size: 724 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230524/f6195c53/attachment.bin>
More information about the llvm-commits
mailing list