| 1 |
.. title:: clang-tidy - misc-misleading-identifier |
| 2 |
|
| 3 |
misc-misleading-identifier |
| 4 |
========================== |
| 5 |
|
| 6 |
Finds identifiers that contain Unicode characters with right-to-left direction, |
| 7 |
which can be confusing as they may change the understanding of a whole statement |
| 8 |
line, as described in `Trojan Source <https://trojansource.codes>`_. |
| 9 |
|
| 10 |
An example of such misleading code follows: |
| 11 |
|
| 12 |
.. code-block:: text |
| 13 |
|
| 14 |
#include <stdio.h> |
| 15 |
|
| 16 |
short int א = (short int)0; |
| 17 |
short int ג = (short int)12345; |
| 18 |
|
| 19 |
int main() { |
| 20 |
int א = ג; // a local variable, set to zero? |
| 21 |
printf("ג is %d\n", ג); |
| 22 |
printf("א is %d\n", א); |
| 23 |
} |