IAR 的一个警告546
Warning :546: transfer of control bypasses initialization of:
Example:
int main(void){
int choice = 1;
int z =1;
switch(choice)
{
case 1:
int y = 1;
z = y + z;
break;
case 2:
break;
}
return 0;
Here, ‘y’ is an initialized variable that is in scope (but unused) in the other cases. The C++ Standard says in section 6.7: “It is possible to transfer into a block, but not in a way that bypasses declarations with initialization. A program that jumps *) from a point where a local variable with automatic storage duration is not in scope to a point where it is in scope is ill-formed unless the variable has POD type (3.9) and is declared without an initializer (8.5).”
*) The transfer from the condition of a switch statement to a case label is considered a jump in this respect.
The usual way to fix this is to enclose the case that declares ‘y’ in braces:
case 1:
{
int y = 1;
z = y + z;
}
break;
“y” is a POD (Plain Old Data) type, so an alternative would be to not use initialization:
case 1:
int y;
y = 1;
z = y + z;
break;
原文在此:http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0434a/index.html
在contiki 的lib->ringbuf.c 的 ringbuf_get() 函数中因 变量 c 可能不会被初始化而导致错误,将 c 声明时赋予 0 即可。
IAR 的一个警告546相关推荐
- C语言编译出现一个警告,16种C语言编译警告(Warning)类型的解决方法
当编译程序发现程序中某个地方有疑问,可能有问题时就会给出一个警告信息.警告信息可能意味着程序中隐含的大错误,也可能确实没有问题.对于警告的正确处理方式应该是:尽可能地消除之.对于编译程序给出的每个警告 ...
- IAR的一个编译错误Error[e27]: Entry GenericApp_Init::?relay in module Coordinator
IAR的一个编译错误Error[e27]: Entry "GenericApp_Init::?relay" in module Coordinator 我们在编译Zigbee协 ...
- php session警告屏蔽,PHP Session的一个警告
警告全文如下: PHP Warning: Unknown: Your script possibly relies on a session side-effect which existed unt ...
- 在MDK 中忽略(suppress) 某一个警告
文章转载自:http://www.51hei.com/bbs/dpj-29515-1.html 有时候我们需要在MDK中忽略掉某一个具体的warnning,怎么做呢? 只需在Misc Control中 ...
- spss安装剩下一个python_SPSSPython脚本在spss命令内部时停止并出现错误spss.提交()将创建一个警告...
假设我有两个变量列表list a: a1 a2 a3 list b: b1 b2 b3 我想用这样的方式处理: ^{pr2}$ 我尝试在python循环中执行此操作:BEGIN PROGRAM. im ...
- TOMCAT6中一个警告“Parameters:Invalid chunk ignored ”
2019独角兽企业重金招聘Python工程师标准>>> 警告:Parameters:Invalid chunk ignored 原因:在链接参数中存在一定的问题和业务逻辑没关系,比如 ...
- IAR中使用struct强制对齐时的一个问题及解决
最近在用IAR开发MSP430程序过程中发现了一个问题,具体描述是这样的 首先定义了一个struct并强制1个字节对齐 #pragma pack(push) //保存对齐状态 #pragma pack ...
- IAR forARM 建立第一个STM32F051的工程
一.自己画了个板子,打样后,自己测试.部分原理图如下: 二.现在建立工程,编写程序来点亮这5个LED灯. 1.好的程序员自己写程序,优秀的程序员偷别人的程序.所以从ST官网上下载相应的资料en.stm ...
- python的division函数_Python/Numpy:Division给了我一个意外的弃用警告
我从一个csv读取数据,然后循环,然后我想除以平均值来规范化它,但得到一个警告.代码是:A = genfromtxt("train.txt", delimiter=';', ski ...
最新文章
- 带你玩玩转 MySQL 查询
- windows redis 客户端_redis高并发的最佳解决方案
- 【NLP】EMNLP'21 | 让压缩语言模型自动搜索最优结构!
- 浅谈地方门户网站运营思路
- 前端MVC Vue2学习总结(四)——条件渲染、列表渲染、事件处理器
- python 生成排列、组合以及选择
- 06 ansible剧本功能实践介绍
- valgrind- 内存泄漏-how to install and use
- 艾尔塔7号/Elta7
- 软件研发模型和软件测试模型
- springboot学习_Spring Boot 开源学习项目代码日爆爆爆
- swf转gaf使用方法
- 2010中国互联网哈哈榜
- IDEA2020如何配置Tomcat
- Python基础1——导入文件数据
- C语言Dialogbox添加图片,dialogbox_传奇服务端CloseBigDialogBox是什么意思
- Leetcode-892. 三维形体的表面积
- 【无标题】ARCGIS 多个线段组成区域如何转面
- UA OPTI544 量子光学4 光与介质相互作用 2-level System Approximation
- android studio 电量,Android Studio 导出Unity插件(剩余电量、信号强度)