GeneralPurpose-DigraphsΒΆ

Digraphs should not be used

Required inputs: IR

Digraphs (two-character sequences like <:, :>, <%, %>, %:, %:%:) are alternative representations of C++ operators intended for keyboards that lack certain characters. Using digraphs makes code harder to read because they don't resemble their corresponding operators. Modern keyboards and tools have no difficulty with standard operator symbols, so digraphs should be avoided.
Bad code (using digraphs):
class MyClass <%             // ERROR: <% is a digraph for {
    int arr<:10:>;           // ERROR: <: and :> are digraphs for [ and ]
%>;                          // ERROR: %> is a digraph for }
Good code (using standard operators):
class MyClass {
    int arr[10];                    // OK: clear and readable
};
Digraph summary:
<:     alternative for [
:>     alternative for ]
<%     alternative for {
%>     alternative for }
%:     alternative for #

Possible Messages

Key

Text

Severity

Disabled

digraph_use

Digraph used.

None

False

Options