GCC的声明表达式(Statements and Declarations in Expressions)

用了很久,一直不知道叫什么

1. GCC的声明表达式

  • 英文:Statements and Declarations in Expressions

2.它的应用是这样子的

  • 应用一:
int baz = ({ 
   int y = foo (); 
   int z;
   if (y > 0) z = y;
   else z = - y;
   z; 
})

  • 应用二:
#define macorBaz(param) ({int bar = 0; bar = param - 1; bar})
int baz = macroBaz(10);

你可能感兴趣的:(GCC的声明表达式(Statements and Declarations in Expressions))