1.. title:: clang-tidy - readability-avoid-unconditional-preprocessor-if 2 3readability-avoid-unconditional-preprocessor-if 4=============================================== 5 6Finds code blocks that are constantly enabled or disabled in preprocessor 7directives by analyzing ``#if`` conditions, such as ``#if 0`` and ``#if 1``, 8etc. 9 10.. code-block:: c++ 11 12 #if 0 13 // some disabled code 14 #endif 15 16 #if 1 17 // some enabled code that can be disabled manually 18 #endif 19 20Unconditional preprocessor directives, such as ``#if 0`` for disabled code 21and ``#if 1`` for enabled code, can lead to dead code and always enabled code, 22respectively. Dead code can make understanding the codebase more difficult, 23hinder readability, and may be a sign of unfinished functionality or abandoned 24features. This can cause maintenance issues, confusion for future developers, 25and potential compilation problems. 26 27As a solution for both cases, consider using preprocessor macros or defines, 28like ``#ifdef DEBUGGING_ENABLED``, to control code enabling or disabling. 29This approach provides better coordination and flexibility when working with 30different parts of the codebase. Alternatively, you can comment out the entire 31code using ``/* */`` block comments and add a hint, such as ``@todo``, 32to indicate future actions. 33