救济的近义词是什么| 鼻子和嘴巴连接的地方叫什么| 三铵复合肥是什么| 什么东西清肺止咳| 势利眼的人有什么特征| 吃什么补记忆力最快| 手麻挂什么科室| 利尿什么意思| 95年五行属什么| 什么样的降落伞| qw医学上是什么意思| 被什么虫子咬了会刺痛| 长期手淫会有什么危害| 草芽是什么| 努尔哈赤是什么意思| 吃什么有助于睡眠| 炖排骨什么时候放盐| 嫖娼什么意思| 地笼捕河虾用什么诱饵| 怀孕两个星期有什么反应| 木全读什么| 甲状腺有血流信号是什么意思| 1991年属羊是什么命| 幽门螺旋杆菌感染是什么意思| 死是什么意思| 逍遥丸主要治什么病| 点子是什么意思| 5月12号是什么星座| 喝黄芪水有什么副作用| 什么药不能一起吃| 人定胜什么| 经常不吃晚饭对身体有什么影响| 命宫是什么意思| 河粉是什么材料做的| 擎什么意思| 吃谷维素有什么副作用| 都有什么水果| 疳积是什么意思| 看脖子应该挂什么科| 音序是什么| 儿童调理脾胃用什么药最好| 排便困难用什么药| nox是什么意思| 梦见生了个女儿是什么意思| gap什么意思| 淋症是什么意思| 大连有什么好吃的| 血脂高胆固醇高吃什么食物最好| 中药地龙是什么| 辩证法是什么| 翻什么覆什么| 什么是气| 宵夜吃什么| 周长是什么| 男头发稀少适合什么发型| 祛痣挂什么科| cd20阳性什么意思| xxoo什么意思| 短发适合什么脸型| 面肌痉挛挂什么科| 乙肝dna检测是查什么| 被艹是什么感觉| 调理脾胃吃什么好| edo是什么意思| 胃反流吃什么药好| 五月是什么星座| wt什么意思| 腿上有白点是什么原因| 吃六味地黄丸有什么好处| 手腕痛什么原因| 脚气用什么药| 什么动物的牙齿最多| 美业是做什么的| 茶壶里煮饺子的歇后语是什么| 富硒对人体有什么好处| 边什么边什么| 尼古丁是什么东西| 声泪俱下是什么意思| edc是什么| 为什么会口臭的原因| 子宫腺肌症吃什么药| 男蛇配什么属相最好| 68年猴五行属什么| 缺什么补什么| 无犯罪记录证明需要什么材料| 黄疸严重会造成什么后果| 什么是黄褐斑| 宝宝发烧挂什么科| 胃肠道感冒吃什么药| 啰嗦是什么意思| 属鼠五行属什么| 黄精泡酒有什么功效| 世界上最硬的东西是什么| 隋炀帝叫什么名字| 梦见大蟒蛇是什么预兆| 篦子是什么东西| 为什么要努力读书| 人工智能是什么意思| 什么叫传统文化| 支气管炎能吃什么水果| 茱萸是什么东西| 容易口腔溃疡什么原因| 什么如镜| 什么叫心律不齐| 什么是强势的女人| 143是什么意思| 藏红花什么时候喝最好| 什么是禁欲| 面粉可以做什么| acei是什么意思| 二龙戏珠是什么意思| 甘油三酯高什么原因| 大便隐血阴性是什么意思| 早上打嗝是什么原因呢| 怀孕20天有什么症状| 嗓子疼喝什么| sunny是什么意思| 奶咖是什么| 忖量是什么意思| 缺钾吃什么好| 钠是什么意思| dvt是什么意思| 处方药是什么意思| 女人手脚发热吃什么药| 舌头肥厚是什么原因| 量程是什么| twin是什么意思| 节节草有什么功效| 晚餐吃什么健康又营养| 肝右叶钙化灶什么意思| 七情六欲指的是什么| 莲蓬什么时候成熟| 11月22是什么星座| 2型糖尿病是什么意思| 哥哥的老婆叫什么| 如泰山前面一个字是什么啊| 19岁属什么的生肖| 男性左下腹疼痛是什么原因| 脊背疼是什么原因| 截瘫是什么意思| semir是什么牌子| 固摄是什么意思| 脖子长痘痘是什么原因| 虾不能跟什么一起吃| 月经不调有什么危害| 经期适合吃什么食物| 额头出油多是什么原因| 香菇吃多了有什么危害| 喉咙发炎吃什么消炎药| 什么是经络| 老睡不着觉是什么原因| 千叶豆腐是什么做的| 身体出汗是什么原因| 肺心病是什么原因引起的| 嗅觉失灵是什么原因| 前列腺增大有什么危害| 头晕是什么感觉| 2月16日是什么星座| 小兔子吃什么| 肋骨痛挂什么科| 大拇指抖动是什么原因引起的| 豪五行属什么| 头疼呕吐吃什么药| 黄芪搭配什么不上火| 右肋骨下方隐隐疼痛是什么原因| 米干是什么| 六十而耳顺是什么意思| 什么是出轨| 什么是射频| 寓言故事有什么| 折什么时候读she| 朋友圈发女朋友照片配什么文字| 左手有痣代表什么| 单身为什么中指戴戒指| 青蛙像什么| 补气血吃什么食物| 腰疼肚子疼是什么原因引起的| 人民是什么| 王母娘娘叫什么名字| 尿维生素c弱阳性是什么意思| 狂野是什么意思| 刑克是什么意思| 道德经适合什么人看| 少一颗牙齿有什么影响| 肝不好吃什么药效果好| 沙中土命什么意思| 盆腔镜检查是查什么的| 五七是什么意思| 什么药降糖效果最好| 雪燕适合什么人吃| 三颗星是什么军衔| 为什么会得结石| 胎停了有什么症状| 米非司酮片是什么药| 小孩子经常流鼻血是什么原因| 羔羊是什么意思| 口嗨是什么意思| 犬瘟吃什么药管用| 喉咙长溃疡是什么原因| 泌尿系统感染什么症状| 球菌阳性是什么意思| 手脱臼有什么症状| 爸爸的哥哥叫什么| 头顶出汗是什么原因| 鳞状上皮化生什么意思| 做绝育手术对女人有什么影响| 低gi什么意思| 发烧应该挂什么科| 11.18是什么星座| 糖链抗原是什么意思| 什么是新陈代谢| 二元酸是什么| 肌酐高什么东西不能吃| 尿酸高吃什么药效果好| 高血压可以吃什么| 睡美人最怕什么| 骨质增生挂什么科| 为什么叫水浒传| 夏天吃什么汤| 血常规异常是什么意思| 行尸走肉什么意思| 属鸡的跟什么属相最配| 1993年出生的属什么| 常染色体是什么| 年少轻狂下一句是什么| 五味子有什么功效和作用| 屁股疼挂什么科室| 肾炎是什么病| 微信拉黑和删除有什么区别| 月经推迟半个月是什么原因| 复合维生素是什么| 秋刀鱼在中国叫什么鱼| 新斯的明是什么药| 内分泌失调什么症状| 什么是血浆| 脱髓鞘病变是什么意思| 虹霓是什么意思| 宫后是牛身上什么部位| 动脉硬化有什么危害| 超声波检查是什么检查| 怀孕什么时候显怀| 借什么可以不还| 藏红花什么时候喝最好| 荟字五行属什么| cd是什么意思| 片仔癀是什么东西| 9月28是什么星座| 胎盘低置需要注意什么| 牙龈肿痛吃什么消炎药| 日出东方下一句是什么| 什么是桃花劫| 海子为什么自杀| 十一点是什么时辰| 胃疼吃点什么药| 第二次世界大战是什么时候| 什么头什么向| 肝火大吃什么药| 什么叫相向而行| 一段奶粉和二段奶粉有什么区别| 缓释是什么意思| 鲜花什么| pc什么意思| 彩字五行属什么| 铜锣湾有什么好玩的| 百度

扫描仪联网警务通 民警现场可查询犬只和主人信息

百度 要鼓励勤劳脱贫,拒绝懒惰,让需要脱贫的人通过自己的辛勤劳动达到脱贫的目标。

In computer science, a record (also called a structure, struct, user-defined type (UDT), or compound data type) is a composite data structure – a collection of fields, possibly of different data types, typically fixed in number and sequence.[1]

For example, a date could be stored as a record containing a numeric year field, a month field represented as a string, and a numeric day-of-month field. A circle record might contain a numeric radius and a center that is a point record containing x and y coordinates.

Notable applications include the programming language record type and for row-based storage, data organized as a sequence of records, such as a database table, spreadsheet or comma-separated values (CSV) file. In general, a record type value is stored in memory and row-based storage is in mass storage.

A record type is a data type that describes such values and variables. Most modern programming languages allow the programmer to define new record types. The definition includes specifying the data type of each field and an identifier (name or label) by which it can be accessed. In type theory, product types (with no field names) are generally preferred due to their simplicity, but proper record types are studied in languages such as System F-sub. Since type-theoretical records may contain first-class function-typed fields in addition to data, they can express many features of object-oriented programming.

Terminology

edit

In the context of storage such as in a database or spreadsheet a record is often called a row and each field is called a column.[2][3][4][5]

In object-oriented programming, an object is a record that contains state and method fields.

A record is similar to a mathematical tuple, although a tuple may or may not be considered a record, and vice versa, depending on conventions and the programming language. In the same vein, a record type can be viewed as the computer language analog of the Cartesian product of two or more mathematical sets, or the implementation of an abstract product type in a specific language.

A record differs from an array in that a record's elements (fields) are determined by the definition of the record, and may be heterogeneous whereas an array is a collection of elements with the same type.[6]

The parameters of a function can be viewed collectively as the fields of a record and passing arguments to the function can be viewed as assigning the input parameters to the record fields. At a low-level, a function call includes an activation record or call frame, that contains the parameters as well as other fields such as local variables and the return address.

History

edit
?
Journal sheet from 1880 United States census, showing tabular data with rows of data, each a record corresponding to a single person.

The concept of a record can be traced to various types of tables and ledgers used in accounting since remote times. The modern notion of records in computer science, with fields of well-defined type and size, was already implicit in 19th century mechanical calculators, such as Babbage's Analytical Engine.[7][8]

?
Hollerith punched card (1895)

The original machine-readable medium used for data (as opposed to control) was the punch card used for records in the 1890 United States census: each punch card was a single record. Compare the journal entry from 1880 and the punch card from 1895. Records were well-established in the first half of the 20th century, when most data processing was done using punched cards. Typically, each record of a data file would be recorded on one punched card, with specific columns assigned to specific fields. Generally, a record was the smallest unit that could be read from external storage (e.g., card reader, tape, or disk). The contents of punchcard-style records were originally called "unit records" because punchcards had pre-determined document lengths.[9] When storage systems became more advanced with the use of hard drives and magnetic tape, variable-length records became the standard. A variable-length record is a record in which the size of the record in bytes is approximately equal to the sum of the sizes of its fields. This was not possible to do before more advanced storage hardware was invented because all of the punchcards had to conform to pre-determined document lengths that the computer could read, since at the time the cards had to be physically fed into a machine.

Most machine language implementations and early assembly languages did not have special syntax for records, but the concept was available (and extensively used) through the use of index registers, indirect addressing, and self-modifying code. Some early computers, such as the IBM 1620, had hardware support for delimiting records and fields, and special instructions for copying such records.

The concept of records and fields was central in some early file sorting and tabulating utilities, such as IBM's Report Program Generator (RPG).

COBOL was the first widespread programming language to support record types,[10] and its record definition facilities were quite sophisticated at the time. The language allows for the definition of nested records with alphanumeric, integer, and fractional fields of arbitrary size and precision, and fields that automatically format any value assigned to them (e.g., insertion of currency signs, decimal points, and digit group separators). Each file is associated with a record variable where data is read into or written from. COBOL also provides a MOVE CORRESPONDING statement that assigns corresponding fields of two records according to their names.

The early languages developed for numeric computing, such as FORTRAN (up to FORTRAN IV) and ALGOL 60, did not support record types; but later versions of those languages, such as FORTRAN 77 and ALGOL 68 did add them. The original Lisp programming language too was lacking records (except for the built-in cons cell), but its S-expressions provided an adequate surrogate. The Pascal programming language was one of the first languages to fully integrate record types with other basic types into a logically consistent type system. The PL/I language provided for COBOL-style records. The C language provides the record concept using structs. Most languages designed after Pascal (such as Ada, Modula, and Java), also supported records. Java introduced records in Java 17 and C# introduced records in C#. Records were introduced to Java to simplify data aggregate classes with less boilerplate, making all fields final and private, automatically generating all-argument constructors, getters, and the methods boolean equals(), int hashCode(), and String toString(). Java records all implicitly extend java.lang.Record.

// The following record:
record Rectangle(double length, double width) {}

// is equivalent to the following class:
public final class Rectangle {
    private final double length;
    private final double width;

    public Rectangle(double length, double width) {
        this.length = length;
        this.width = width;
    }

    public double length() {
        return this.length;
    }

    public double width() {
        return this.width;
    }

    @Override
    public boolean equals(Rectangle other) {
        return (this.length == other.length) && (this.width == other.width);
    }

    @Override
    public int hashCode() {
        return Objects.hash(length, width);
    }

    @Override
    public String toString() {
        return String.format("Rectangle[length=%s, width=%s]", length, width); 
    }
}

Although records are not often used in their original context anymore (i.e. being used solely for the purpose of containing data), records influenced newer object-oriented programming languages and relational database management systems. Since records provided more modularity in the way data was stored and handled, they are better suited at representing complex, real-world concepts than the primitive data types provided by default in languages. This influenced later languages such as C++, Python, JavaScript, and Objective-C which address the same modularity needs of programming.[11] Objects in these languages are essentially records with the addition of methods and inheritance, which allow programmers to manipulate the way data behaves instead of only the contents of a record. Many programmers regard records as obsolete now since object-oriented languages have features that far surpass what records are capable of. On the other hand, many programmers argue that the low overhead and ability to use records in assembly language make records still relevant when programming with low levels of abstraction. Today, the most popular languages on the TIOBE index, an indicator of the popularity of programming languages, have been influenced in some way by records due to the fact that they are object oriented.[12] Query languages such as SQL and Object Query Language were also influenced by the concept of records. These languages allow the programmer to store sets of data, which are essentially records, in tables.[13] This data can then be retrieved using a primary key. The tables themselves are also records which may have a foreign key: a key that references data in another table.

Record type

edit

Operations

edit

Operations for a record type include:

  • Declaration of a record type, including the position, type, and (possibly) name of each field
  • Declaration of a record; a variable typed as a record type
  • Construction of a record value; possibly with field value initialization
  • Read and write record field value
  • Comparison of two records for equality
  • Computation of a standard hash value for the record

Some languages provide facilities that enumerate the fields of a record. This facility is needed to implement certain services such as debugging, garbage collection, and serialization. It requires some degree of type polymorphism.

In contexts that support record subtyping, operations include adding and removing fields of a record. A specific record type implies that a specific set of fields are present, but values of that type may contain additional fields. A record with fields x, y, and z would thus belong to the type of records with fields x and y, as would a record with fields x, y, and r. The rationale is that passing an (x,y,z) record to a function that expects an (x,y) record as argument should work, since that function will find all the fields it requires within the record. Many ways of practically implementing records in programming languages would have trouble with allowing such variability, but the matter is a central characteristic of record types in more theoretical contexts.

Assignment and comparison

edit

Most languages allow assignment between records that have exactly the same record type (including same field types and names, in the same order). Depending on the language, however, two record data types defined separately may be regarded as distinct types even if they have exactly the same fields.

Some languages may also allow assignment between records whose fields have different names, matching each field value with the corresponding field variable by their positions within the record; so that, for example, a complex number with fields called real and imag can be assigned to a 2D point record variable with fields X and Y. In this alternative, the two operands are still required to have the same sequence of field types. Some languages may also require that corresponding types have the same size and encoding as well, so that the whole record can be assigned as an uninterpreted bit string. Other languages may be more flexible in this regard, and require only that each value field can be legally assigned to the corresponding variable field; so that, for example, a short integer field can be assigned to a long integer field, or vice versa.

Other languages (such as COBOL) may match fields and values by their names, rather than positions.

These same possibilities apply to the comparison of two record values for equality. Some languages may also allow order comparisons ('<'and '>'), using the lexicographic order based on the comparison of individual fields.[citation needed]

PL/I allows both of the preceding types of assignment, and also allows structure expressions, such as a = a+1; where "a" is a record, or structure in PL/I terminology.

Algol 68's distributive field selection

edit

In Algol 68, if Pts was an array of records, each with integer fields X and Y, one could write Y of Pts to obtain an array of integers, consisting of the Y fields of all the elements of Pts. As a result, the statements Y of Pts[3]?:= 7 and (Y of Pts)[3]?:= 7 would have the same effect.

Pascal's "with" statement

edit

In Pascal, the command with R do S would execute the command sequence S as if all the fields of record R had been declared as variables. Similarly to entering a different namespace in an object-oriented language like C#, it is no longer necessary to use the record name as a prefix to access the fields. So, instead of writing Pt.X?:= 5; Pt.Y?:= Pt.X + 3 one could write with Pt do begin X := 5; Y := X + 3 end.

Representation in memory

edit

The representation of a record in memory varies depending on the programming language. Often, fields are stored in consecutive memory locations, in the same order as they are declared in the record type. This may result in two or more fields stored into the same word of memory; indeed, this feature is often used in systems programming to access specific bits of a word. On the other hand, most compilers will add padding fields, mostly invisible to the programmer, in order to comply with alignment constraints imposed by the machine—say, that a floating point field must occupy a single word.

Some languages may implement a record as an array of addresses pointing to the fields (and, possibly, to their names and/or types). Objects in object-oriented languages are often implemented in rather complicated ways, especially in languages that allow multiple class inheritance.

Self-defining records

edit

A self-defining record is a type of record which contains information to identify the record type and to locate information within the record. It may contain the offsets of elements; the elements can therefore be stored in any order or may be omitted.[14] The information stored in a self-defining record can be interpreted as metadata for the record, which is similar to what one would expect to find in the UNIX metadata regarding a file, containing information such as the record's creation time and the size of the record in bytes. Alternatively, various elements of the record, each including an element identifier, can simply follow one another in any order.

Key field

edit

A record, especially in the context of row-based storage, may include key fields that allow indexing the records of a collection. A primary key is unique throughout all stored records; only one of this key exists.[15] In other words, no duplicate may exist for any primary key. For example, an employee file might contain employee number, name, department, and salary. The employee number will be unique in the organization and will be the primary key. Depending on the storage medium and file organization, the employee number might be indexed—that is also stored in a separate file to make the lookup faster. The department code is not necessarily unique; it may also be indexed, in which case it would be considered a secondary key, or alternate key.[16] If it is not indexed, the entire employee file would have to be scanned to produce a listing of all employees in a specific department. Keys are usually chosen in a way that minimizes the chances of multiple values being feasibly mapped to by one key. For example, the salary field would not normally be considered usable as a key since many employees will likely have the same salary.

See also

edit

References

edit
  1. ^ Felleisen, Matthias (2001). How To Design Programs. MIT Press. pp.?53, 60. ISBN?978-0262062183.
  2. ^ "Computer Science Dictionary Definitions". Computing Students. Retrieved Jan 22, 2018.
  3. ^ Radványi, Tibor (2014). Database Management Systems. Eszterházy Károly College. p.?19. Archived from the original on 2025-08-14. Retrieved 23 September 2018.
  4. ^ Kahate, Atul (2006). Introduction to Database Management Systems. Pearson. p.?3. ISBN?978-81-317-0078-5. Retrieved 23 September 2018.
  5. ^ Connolly, Thomas (2004). Database Solutions: A Step by Step Guide to Building Databases (2nd?ed.). Pearson. p.?7. ISBN?978-0-321-17350-8.
  6. ^ Pape, Tobias; Kirilichev, Vasily; Bolz, Carl Friedrich; Hirschfeld, Robert (2025-08-14). "Record data structures in racket: usage analysis and optimization". ACM SIGAPP Applied Computing Review. 16 (4): 25–37. doi:10.1145/3040575.3040578. ISSN?1559-6915. S2CID?14306162.
  7. ^ Bromley, Allan (October 1998). "Charles Babbage's Analytical Engine, 1838". IEEE Annals of the History of Computing. 20 (4): 29–45. doi:10.1109/85.728228. S2CID?2285332. Retrieved 23 September 2018.
  8. ^ Swade, Doron. "Automatic Computation: Charles Babbage and Computational Method". The Rutherford Journal. Retrieved 23 September 2018.
  9. ^ Edwin D. Reilly; Anthony Ralston; David Hemmendinger, eds. (2003). Encyclopedia of computer science (4th?ed.). Chichester, UK: Wiley. ISBN?978-1-84972-160-8. OCLC?436846454.
  10. ^ Sebesta, Robert W. (1996). Concepts of Programming Languages (Third?ed.). Addison-Wesley Publishing Company, Inc. p.?218. ISBN?0-8053-7133-8.
  11. ^ Leavens, Gary T.; Weihl, William E. (1990). "Reasoning about object-oriented programs that use subtypes". Proceedings of the European conference on object-oriented programming on Object-oriented programming systems, languages, and applications - OOPSLA/ECOOP '90. New York, New York, USA: ACM Press. pp.?212–223. doi:10.1145/97945.97970. ISBN?0-201-52430-9. S2CID?46526.
  12. ^ "Index: The Software Quality Company". TIOBE.com. Retrieved 2025-08-14.
  13. ^ "What is a Relational Database (RDBMS)?". Oracle. Retrieved February 28, 2022.
  14. ^ Kraimer, Martin R. "EPICS Input / Output Controller (IOC) Application Developer's Guide". Argonne National Laboratory. Retrieved November 25, 2015.
  15. ^ "Add or change a table's primary key in Access". support.microsoft.com. Retrieved 2025-08-14.
  16. ^ "Alternate key - Oracle FAQ". www.orafaq.com. Retrieved 2025-08-14.
狂风暴雨是什么意思 太阴是什么意思 95年属什么的 尿发黄是什么原因 五官立体是什么意思
健硕是什么意思 微信屏蔽是什么意思 cas号是什么意思 发烧一直不退是什么原因 糗大了是什么意思
jackjones是什么品牌 疼和痛有什么区别 脑梗塞什么症状 tsh是什么意思 屎为什么是黑色的
1994年属狗是什么命 不苟言笑的苟是什么意思 为什么会心悸 地铁站务员是干什么的 两融余额是什么意思
全身皮肤瘙痒是什么原因引起的hcv8jop0ns4r.cn 胎膜早破是什么原因引起的mmeoe.com apm是什么意思hcv8jop4ns8r.cn 上将相当于什么级别baiqunet.com 为什么纯牛奶容易爆痘hcv8jop9ns9r.cn
芝五行属什么hcv7jop9ns4r.cn 双瞳电影到底讲了什么hcv8jop6ns8r.cn 唾液酸苷酶阳性什么意思hcv9jop2ns8r.cn 荨麻疹吃什么药好的快zhongyiyatai.com 钓鱼执法什么意思hcv9jop0ns5r.cn
取环后吃什么恢复子宫hcv9jop6ns8r.cn 扁桃体疼吃什么药hcv9jop0ns6r.cn 糖尿病的症状是什么hcv9jop4ns2r.cn ptsd是什么病hcv7jop5ns3r.cn 急得很什么hcv9jop3ns7r.cn
麻是什么植物hcv8jop5ns4r.cn 什么叫免疫治疗hcv8jop4ns4r.cn 共济失调是什么病hcv8jop3ns8r.cn 骨蒸潮热是什么症状hcv9jop5ns3r.cn 1932年属什么hcv9jop3ns8r.cn
百度