19 lines · plain
1.. title:: clang-tidy - readability-avoid-nested-conditional-operator2 3readability-avoid-nested-conditional-operator4=============================================5 6Identifies instances of nested conditional operators in the code.7 8Nested conditional operators, also known as ternary operators, can contribute9to reduced code readability and comprehension. So they should be split as10several statements and stored the intermediate results in temporary variable.11 12Examples:13 14.. code-block:: c++15 16 int NestInConditional = (condition1 ? true1 : false1) ? true2 : false2;17 int NestInTrue = condition1 ? (condition2 ? true1 : false1) : false2;18 int NestInFalse = condition1 ? true1 : condition2 ? true2 : false1;19