当前位置:网站首页>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边栏推荐
- Process the dataset and use labelencoder to convert all IDs to start from 0
- [fluent] JSON model conversion (JSON serialization tool | JSON manual serialization | writing dart model classes according to JSON | online automatic conversion of dart classes according to JSON)
- 左值右指解释的比较好的
- Andwhere multiple or query ORM conditions in yii2
- Linear rectification function relu and its variants in deep learning activation function
- Yiwen takes you to know ZigBee
- I2C subsystem (II): I3C spec
- Kubernetes family container housekeeper pod online Q & A?
- Serious security vulnerabilities reported by moxa mxview network management software
- 超好用的日志库 logzero
猜你喜欢
Random Shuffle attention
From C to capable -- use the pointer as a function parameter to find out whether the string is a palindrome character
Kubernetes family container housekeeper pod online Q & A?
超好用的日志库 logzero
Linear rectification function relu and its variants in deep learning activation function
What does "where 1=1" mean
Today, it's time to copy the bottom!
Sous - système I2C (IV): débogage I2C
Pytest (6) -fixture (Firmware)
Installation and use of memory leak tool VLD
随机推荐
Gbase 8C trigger (I)
Introduction to cron expression
Practice of traffic recording and playback in vivo
Add some hard dishes to the interview: how to improve throughput and timeliness in delayed task scenarios!
Serious security vulnerabilities reported by moxa mxview network management software
左连接,内连接
基于can总线的A2L文件解析(2)
Gbase 8C system table PG_ amproc
[flutter] example of asynchronous programming code between future and futurebuilder (futurebuilder constructor setting | handling flutter Chinese garbled | complete code example)
[translation] flux is safe. Gain more confidence through fuzzy processing
为什么会选择框架?选择什么样的框架
tensor中的append应该如何实现
[shutter] banner carousel component (shutter_wiper plug-in | swiper component)
tensorflow转pytorch笔记;tf.gather_nd(x,y)转pytorch
Didi programmers are despised by relatives: an annual salary of 800000 is not as good as two teachers
C语言初阶-指针详解-庖丁解牛篇
《MATLAB 神经网络43个案例分析》:第43章 神经网络高效编程技巧——基于MATLAB R2012b新版本特性的探讨
定了,就选它
[principles of multithreading and high concurrency: 1_cpu multi-level cache model]
[hcia]no.15 communication between VLANs