Skip to content

Commit

Permalink
Add link to S6023
Browse files Browse the repository at this point in the history
  • Loading branch information
loic-joly-sonarsource committed Dec 19, 2024
1 parent be4040e commit 1180856
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion rules/S7172/cfamily/rule.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ void perform(Node node, optional<bool> recursive, Action action) {
}
----

In this simple case, the use of both `recursive` and `++*recursive++` hints that recursive is more than a simple `bool`. However, it is possible to write the code with a higher level semantic:
In this simple case, the use of both `recursive` and `++*recursive++` hints that recursive is more than a simple `bool`. However, it is possible to write the code with a higher level semantic (see S6023):

[source,cpp]
----
Expand All @@ -117,6 +117,11 @@ void perform(optional<bool> recursive) {
This syntax is more complex, but it is also more flexible, especially when chaining operations on `optional` or `expected` values.

== Resources

=== Related rules

* S6023 - "std::optional" member function "value_or" should be used

=== Documentation

* {cpp} reference - https://en.cppreference.com/w/cpp/utility/optional[`std::optional`]
Expand Down

0 comments on commit 1180856

Please sign in to comment.