Skip to content

Commit

Permalink
CPP-4873 S1001: Literals namespaces should be allowlisted from the rule
Browse files Browse the repository at this point in the history
  • Loading branch information
loic-joly-sonarsource authored Jan 23, 2024
1 parent b97c7b8 commit d1fe2c3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion rules/S1001/cfamily/rule.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@

`using` directives add additional scopes to the set of scopes searched during name lookup. All identifiers in these scopes become visible, increasing the possibility that the identifier found by the compiler does not meet developer expectations.

Using-declarations or fully-qualified names restricts the set of names considered to only the name explicitly specified, and so these are safer options.
_Using-declarations_ or fully-qualified names restricts the set of names considered to only the name explicitly specified, and so these are safer options.

=== Exceptions

It is not easy to fully qualify the content of the `std::literals` and `std::placeholders` namespaces. Therefore, this rule does not raise violations for `using` directives that target these namespaces or their sub-namespaces.

=== Noncompliant code example

Expand Down

0 comments on commit d1fe2c3

Please sign in to comment.