在 Jens Gustedt 的《Modern C》一书中,作者做出了以下陈述:
In the following subsections, we will introduce the syntactical aspects (grammar) and three different semantic aspects: declarative parts (what things are), definitions of objects (where things are), and statements (what things are supposed to do).
The declarations of i and A declare variables , which are named items that allow us to store values. They are best visualized as a kind of box that may contain a “something” of a particular type:
Conceptually, it is important to distinguish the box itself (the object), the specification (its type), the box contents (its value), and the name or label that is written on the box (the identifier). In such diagrams, we put ?? if we don’t know the actual value of an item.
Generally, declarations only specify the kind of object an identifier refers to, not what the concrete value of an identifier is, nor where the object it refers to can be found. This important role is filled by a definition.
关于上述陈述的问题:
作者的第一和第三个陈述暗示定义指定了标识符引用的对象的位置。 “哪里”在这里是什么意思,特别是如何在定义中指定标识符的具体值与标识符所指的对象所在的位置相同/不同?
根据陈述 2,什么是 '从概念上讲,区分盒子本身(对象)、规范(其类型)、盒子内容(其值)以及名称或标签很重要写在盒子上(标识符)。意思是?为什么这里的“盒子”是对象而不是“盒子”中的值?
最佳答案
对象是可以存储值的地方。这是该语言使用的术语。
形式上,一个对象是一个
region of data storage in the execution environment, the contents of which can represent values
https://port70.net/~nsz/c/c11/n1570.html#3.15p1
本书作者使用了“盒子”这个词,这在非正式讨论中是完全合适的。
关于c - C语言中 'objects'是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72210270/