当前位置:网站首页>Keil debug view variable prompt not in scope
Keil debug view variable prompt not in scope
2022-06-25 06:42:00 【A little big:)】
Screenshot of the problem :
There was a warning when compiling :…\src\user_main.c(155): warning: #550-D: variable “crc_buffer” was set but never used
I started by changing the variable type , from uint32_t Changed to uint8_t,uint16_t,uint64_t No way to find out , I wonder if it has been optimized , Then the optimization level is changed, as shown in the figure below , from Level 3 Changed to Level 0 I can't find it .

But I still want to be optimized , But I didn't think of a way .
I solved the warning , This variable is used , Even if this variable is used in the wrong way , But I can see the value , Here's the picture .
I consulted my master who is now in the company ( Miss Zhao ), Then he prompted me to use volatile, Then I found that I could see the value , Then he let me change to static, I found that it can also , Then I was prompted to think about the area where my parameter variables were placed ( Stack ), Let me think for myself .
My thoughts ( If you make a mistake, please correct it ):
Compiler optimization , Command variables in the optimization stack , If you don't optimize variables in the stack , So it's like I declared many variables but didn't use them , It can easily lead to stack overflow problems . Add volatile The keyword is to prevent the compiler from optimizing this variable in the stack , Use static This variable is not stored on the stack , It is stored in the static variable area ( Pile up ), Then it will not be optimized .
After the above thought , I just thought if that was the case , If I change a variable into a global variable, there is no problem , The fact is that there is no problem .
I changed the optimization level again , from Level 0 Changed to not use (default), And the variables are still on the stack ( local variable ) in , Discover or not in scope
I will read many articles to solve this problem , Is to write and change the optimization level , But it was not written on the dot , Why change the optimization level ? Are there other ways to prevent optimization ?
After this, I also know a little about compiler optimization .
边栏推荐
- Ht8513 single lithium battery power supply with built-in Dynamic Synchronous Boost 5W mono audio power amplifier IC solution
- 集群常用群起脚本
- Go language library management restful API development practice
- TCP BBR as rate based
- Viewing Chinese science and technology from the Winter Olympics (V): the Internet of things
- 十大券商公司哪个佣金最低,最安全可靠?有知道的吗
- How do I check swift if two arrays contain the same elements, regardless of the order in which they appear?
- Zhinai's database
- [speech discrimination] discrimination of speech signals based on MATLAB double threshold method [including Matlab source code 1720]
- Kubernetes cluster dashboard & kuboard installation demo
猜你喜欢

Cs5092 5V USB input boost two section lithium battery charging management IC, SOT23-6 miniature package

Face++ realizes face detection by flow

Hongmeng learning notes: creating layouts using XML

爱情️终结者

父爱的表达方式

After unplugging the network cable, does the original TCP connection still exist?

Kubernetes core components etcd details

joda.time获取日期总结

ACWING2013. 三条线

有能力的人从不抱怨大环境!
随机推荐
Understand what MTU is
Why can't GC () free memory- Why does gc() not free memory?
【ROS2】为什么要使用ROS2?《ROS2系统特性介绍》
sin(a+b)=sina*cosb+sinb*cosa的推导过程
Missing libgmp-10 dll - libgmp-10. dll is missing
Ht81293 built in adaptive dynamic boost 20W mono class D power amplifier IC solution
Unity获取资源路径
2022 AI trend 8 forecast!
Bcrypt password encryption kalrry
Leetcode 2163. Minimum difference of sum after element deletion
After unplugging the network cable, does the original TCP connection still exist?
Sophomores majoring in mechanics build a manipulator by hand -- full of compromise
有能力的人从不抱怨大环境!
Flask 的入门级使用
You can see the classification of SQL injection. SQL injection point /sql injection type /sql injection has several /sql injection point classifications
Your local changes to the following files would be overwritten by merge: .vs/slnx.sqlite
了解zbrush雕刻软件,以及游戏建模的分析
Derivation of COS (a-b) =cosa*cosb+sina*sinb
The Rust Programming Language
Is the number of indexes in a table the more the better?