当前位置:网站首页>Variable declarations following if statements
Variable declarations following if statements
2022-07-03 02:52:00 【French red wine sweet】
problem :
An issue came up on another forum and I knew how to fix it, but it revealed a feature of the compiler peculiar to me. There is a problem in another forum , I know how to solve it , But it reveals my unique compiler features .The person was getting the error "Embedded statement cannot be a declaration or labeled statement" because they had a declaration of a variable following an if statement with no brackets. This person received an error message “ Embedded statements cannot be declarative or tagged statements ”, Because they're if There is an parenthesized variable declaration after the statement .That was not their intent, but they had commented out the line of code immediately following the if statement, which made the variable declaration the de facto line of code to execute. This is not their intention , But they are if The code line is commented out immediately after the statement , This makes the variable declaration the line of code to actually execute .Anyway, that's the background, which brings me to this. in any case , This is the background , This reminds me of this .
The following code is illegal The following code is illegal
if (true) int i = 7;
However, if you wrap that in brackets, it's all legal. however , If you put it in square brackets , Is completely legal .
if (true){ int i = 7;}
Neither piece of code is useful. These two pieces of code are useless .Yet the second one is OK. The second one is ok .What specifically is the explanation for this behavior? What is the specific explanation for this behavior ?
Solution :
Reference resources : https://stackoom.com/en/question/ATTZ边栏推荐
- Practice of traffic recording and playback in vivo
- As a leader, how to control the code version and demand development when the epidemic comes| Community essay solicitation
- What does "where 1=1" mean
- 【翻译】后台项目加入了CNCF孵化器
- Gbase 8C function / stored procedure definition
- Gbase 8C trigger (III)
- [C language] MD5 encryption for account password
- HTB-Devel
- [shutter] setup of shutter development environment (supplement the latest information | the latest installation tutorial on August 25, 2021)
- Kubernetes family container housekeeper pod online Q & A?
猜你喜欢
From C to capable -- use the pointer as a function parameter to find out whether the string is a palindrome character
左连接,内连接
Deep Reinforcement Learning for Intelligent Transportation Systems: A Survey 论文阅读笔记
The Linux server needs to install the agent software EPS (agent) database
The process of connecting MySQL with docker
Check log4j problems using stain analysis
sql server数据库添加 mdf数据库文件,遇到的报错
[hcia]no.15 communication between VLANs
错误Invalid bound statement (not found): com.ruoyi.stock.mapper.StockDetailMapper.xxxx解决
Add automatic model generation function to hade
随机推荐
I2C 子系統(四):I2C debug
SQL Server Query spécifie la structure de la table
[C语言]给账号密码进行MD5加密
怎么将yolov5中的PANet层改为BiFPN
用docker 連接mysql的過程
JS finds all the parent nodes or child nodes under a node according to the tree structure
Concrete CMS vulnerability
ASP. Net core 6 framework unveiling example demonstration [02]: application development based on routing, MVC and grpc
Gbase 8C trigger (III)
Random Shuffle attention
Add some hard dishes to the interview: how to improve throughput and timeliness in delayed task scenarios!
Kubernetes cluster log and efk architecture log scheme
Segmentation fault occurs during VFORK execution
The Linux server needs to install the agent software EPS (agent) database
Gbase 8C system table PG_ auth_ members
搭建私有云盘 cloudreve
Counter统计数量后,如何返回有序的key
Deep learning: multi-layer perceptron and XOR problem (pytoch Implementation)
Add automatic model generation function to hade
C语言初阶-指针详解-庖丁解牛篇