1. Си / Говнокод #26006

    +1

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    // https://gcc.gnu.org/onlinedocs/cpp/Directives-Within-Macro-Arguments.html
    
    // Occasionally it is convenient to use preprocessor directives within the arguments
    // of a macro. The C and C++ standards declare that behavior in these cases is
    // undefined. GNU CPP processes arbitrary directives within macro arguments in
    // exactly the same way as it would have processed the directive were the
    // function-like macro invocation not present. 
    
    // If, within a macro invocation, that macro is redefined, then the new definition
    // takes effect in time for argument pre-expansion, but the original definition is
    // still used for argument replacement. Here is a pathological example:
    
    #define f(x) x x
    f (1
    #undef f
    #define f 2
    f)
    
    // which expands to
    
    // 1 2 1 2

    Ну и хуйня.

    Запостил: j123123, 31 Октября 2019

    Комментарии (6) RSS

    Добавить комментарий