c语言int a什么意思,问一下吧里大神 int a = a; 这么定义是什么意思?
該樓層疑似違規(guī)已被系統(tǒng)折疊?隱藏此樓查看此樓
使用自身初始化,具有indeterminate value,可能是trap representation導(dǎo)致使用這個(gè)對(duì)象的值引起undefined behavior。但這個(gè)初始化語(yǔ)法上是正確的,也沒(méi)有語(yǔ)義錯(cuò)誤。
ISO C11
3.19.2
1 indeterminate value
either an unspecified value or a trap representation
3.19.3
1 unspecified value
valid value of the relevant type where this International Standard imposes no requirements on which value is chosen in any instance
2 NOTE An unspecified value cannot be a trap representation.
3.19.4
1 trap representation
an object representation that need not represent a value of the object type
6.1
7 Structure, union, and enumeration tags have scope that begins just after the appearance of the tag in a type specifier that declares the tag. Each enumeration constant has scope that begins just after the appearance of its defining enumerator in an enumerator list. Any other identifier has scope that begins just after the completion of its declarator.
6.2.6.1
5 Certain object representations need not represent a value of the object type. If the stored value of an object has such a representation and is read by an lvalue expression that does not have character type, the behavior is undefined. If such a representation is produced by a side effect that modifies all or any part of the object by an lvalue expression that does not have character type, the behavior is undefined.50) Such a representation is called a trap representation.
50) Thus, an automatic variable can be initialized to a trap representation without causing undefined behavior, but the value of the variable cannot be used until a proper value is stored in it.
6.7.9
10 If an object that has automatic storage duration is not initialized explicitly, its value is indeterminate. ...
總結(jié)
以上是生活随笔為你收集整理的c语言int a什么意思,问一下吧里大神 int a = a; 这么定义是什么意思?的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: xampp for mac mysql_
- 下一篇: 魅族15系统是android,魅族15系