索引
1.iteration 16 invokes undefined behavior**
常见于对数组的操作,数组溢出错误。
数组定义为20个字节,而for循环判断条件应为<20
uint8_t oldrelay[20] = { 0U };
for ( i = INDUCTOR_160nH; i <= 20; i++ )
{
oldrelay[ i ] = SET;
relay[ i ] = RESET;
}
2.warning: excess elements in array initializer**
数组元素比定义元素多
3.passing argument 1 of ‘sprintf’ discards ‘volatile’ qualifier from pointer target type**
加上强制转换
volatile uint8_t str[10];
sprintf((char*)str,“0”);
4 in expansion of macro
宏定义错误
在头文件中避免短宏定义,容易重复;例如
//#define SIZE 24
prop_name 参数为 SIZE
LV_STYLE_##prop_name
预编译为 LV_STYLE_24 出错