- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 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
guest8 31.10.2019 13:39 # −999
3oJIoTou_xyu 31.10.2019 13:59 # +2
Desktop 31.10.2019 14:08 # +4
guest8 01.11.2019 00:10 # −999
guest8 01.11.2019 00:15 # −999
bormand 10.11.2019 11:08 # 0
Кстати, а через это объявление макросов посреди их использования можно замутить что-то реально полезное?