Keil中使有C99及其新特性
Keil选择C99编译
- Keil选择C99编译
- C99特性介绍
- 选择C/C++,勾选C99
- 宏支持可变参数定义,例如
#define NRF_LOG_INFO(...) printf( __VA_ARGS__)
-
增加新关键字,如下 restrict,inline,_Complex,_Imaginary,_Bool
-
新增类型支持,如下 long long,long double _Complex,float _Complex
-
支持不定长数组,例如
void test_func(int *buf,int len)
{
int temp[len];
memcpy(temp,buf,len);
}
- 新增结构体/数组的初始化方式
struct
{
int x;
int y;
} xy ={ .x = 1, .y = 2 };
- 允许 struct 定义的最后定义不定长度数组
struct test
{
int x;
int y[];
}t;