strange result on macro expansion

前端 未结 4 991
误落风尘
误落风尘 2020-12-21 06:46

Consider the following code snippet

#include
#define A -B
#define B -C
#define C 5

int main()
{
  printf(\"The value of A is %d\\n\", A);
  r         


        
4条回答
  •  温柔的废话
    2020-12-21 07:19

    I do not think so. Even macro expansion is text processing, it is impossible to create a token from across macro boundaries. Therefore it as -(-5), not --5, because -- is a single token.

提交回复
热议问题