下面内容收藏于网络
#ifdef CONFIG_EXAMPLE_CONNECT_IPV6
#define NR_OF_IP_ADDRESSES_TO_WAIT_FOR (s_active_interfaces*2)
#else
#define NR_OF_IP_ADDRESSES_TO_WAIT_FOR (s_active_interfaces)
#endif
static int s_active_interfaces = 0;
上面宏定义本身代表的是变量,也是此种定义方式的常用形式,使用中就可以用宏定义代替变量