当前位置:网站首页>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 .
边栏推荐
- STL map的用法
- JS to determine whether an element exists in the array (four methods)
- Understand what MTU is
- Derivation of COS (a-b) =cosa*cosb+sina*sinb
- Navicat防止新建查询误删
- Acwing2013. three lines
- Comparison test of mono 120W high power class D power amplifier chip cs8683-tpa3116
- 直接选择排序和快速排序
- Unity获取资源路径
- DataX tutorial (10) - hot plug principle of dataX plug-in
猜你喜欢
Hongmeng learning notes: creating layouts using XML
Analysis on the scale of China's smart airport industry in 2020: there is still a large space for competition in the market [figure]
Zero foundation wants to learn web security, how to get started?
Cloning and importing DOM nodes
From file system to distributed file system
Face++ realizes face detection by flow
Laravel8+ wechat applet generates QR code
Who can teach me how to learn SCM, what to learn first and how to get started?
Wechat applet authorization login + mobile phone sending verification code +jwt verification interface (laravel8+php)
CTFHub-Web-信息泄露-目录遍历
随机推荐
ACWING/2004. Misspelling
原子Alpha开发板--SD卡和emmc烧录工具
sin(a-b)=sina*cosb-sinb*cosa的推导过程
Metauniverse in 2022: robbing people, burning money and breaking through the experience boundary
ASP. Net core - encrypted configuration in asp NET Core
Your local changes to the following files would be overwritten by merge: .vs/slnx.sqlite
Analysis of common interview questions in redis
DataX tutorial (09) - how does dataX achieve speed limit?
[no title] dream notes 2022-02-20
Derivation of sin (a-b) =sina*cosb-sinb*cosa
Three laws of go reflection
Preliminary practice of niuke.com (summary)
集群常用群起脚本
Kubernetes core components etcd details
Bcrypt password encryption kalrry
Are you still doing the dishes yourself? Teach you how to make dishwasher controller with single chip microcomputer
Ctfhub web - divulgation d'informations - traversée du Répertoire
Can TCP syn handshake messages transmit data
Wan Yin revealed that he was rejected by MIT in this way: "the department doesn't like you". He confronted the principal and realized
Face++ realizes face detection by flow