飞检是什么意思| 鸭肉和什么不能一起吃| 天天喝酒会得什么病| 属鸡与什么属相最配| 心律不齐吃什么药最快| 阿扎西是什么意思| nsnm什么意思| 夜里2点到3点醒什么原因| 低血压低是什么原因| 微不足道的意思是什么| 胰岛素是什么器官分泌的| 脑梗的人适合吃什么食物| 上火为什么会牙疼| 胃寒吃什么好| 白袜子是什么意思| 目赤是什么症状| 渐冻症是什么病| 四离日是什么意思| 阴吹是什么| 梦到狗什么意思| 腹泻挂什么科| 痉挛是什么症状| 什么东西泡水喝降血压| 畏寒怕冷是什么原因| 磁共振和ct有什么区别| 18岁是什么生肖| 喝什么茶最减肥| 张家界地貌属于什么地貌| 18是什么意思| 没有什么| 雷人是什么意思啊| 知足是什么意思| 什么中华| 全身瘙痒是什么原因| 黑头发有什么好处脑筋急转弯| 手腕血管疼是什么原因| 泰国有什么好玩| 肌肉酸痛吃什么药| 吉数是什么生肖| 唏嘘什么意思| 心胸狭窄是什么意思| 龙头烤是什么鱼| 小暑吃什么| nt什么货币| rr过低是什么意思| 身高别体重是什么意思| 1887年属什么生肖| 土地出让和划拨有什么区别| 贴切是什么意思| 特朗普为什么叫川普| doris什么意思| 国企混改是什么意思| 汽车抖动是什么原因| 国企董事长是什么级别| 假牙什么材质的最好| 档案自由可投什么意思| 幽门螺杆菌感染吃什么药| 维生素e有什么作用| 硕的拼音是什么| 2020是什么年| blk是什么意思| 山茶花什么颜色| 左肾小结石是什么意思| 来姨妈可以吃什么水果| 膀胱炎做什么检查能看出来| 海螺不能和什么一起吃| 红参和人参有什么区别| 胃炎吃什么最好| 早上起来眼睛肿了是什么原因| 肝不好有什么症状| 白居易有什么之称| 今天什么日子老黄历| casio是什么牌子| 什么是边界感| 子宫内膜粘连有什么症状| 天恩是什么意思| 狗狗发烧吃什么药| 青津果的功效是什么| 什么不| 小龙虾什么季节| 骨髓炎是什么症状| 儿童肺炎吃什么药| 曼陀罗是什么意思| 为什么活得这么累| 抬头纹用什么护肤品可以去除| 磷高吃什么药| 为什么会得人乳头瘤病毒| 牙虫是什么样的图片| 瑶浴是什么意思| 第二视角是什么意思| 为什么会得子宫肌瘤| 什么上树全靠一张嘴| 什么是积食| 小便有点刺痛是什么原因引起的| 咳嗽吃什么食物好得快| 头晕是什么病的前兆| 琅琊榜是什么意思| 肚子大是什么原因造成的| 经常放屁吃什么药好| 生长因子是什么| 金屋藏娇定富贵是什么生肖| 肚子胀疼是什么原因| 什么是穿刺| 肉燕是什么| 嘴边长痘痘是什么原因| 梦见打牌是什么意思| 恶寒发热是什么意思| 妹妹你坐船头是什么歌| 本科一批和本科二批有什么区别| 孕吐 吃什么| 手淫多了有什么危害| 礼物送什么| 免疫力低有什么症状| 结婚9年是什么婚| 6月25什么星座| 睡眠不好吃什么药最有效| 中药先煎是什么意思| 梦到自己流鼻血是什么预兆| 甲亢病吃什么药效果好| 感冒去医院挂什么科| 看望病人送什么东西| 频繁流鼻血是什么病的前兆| 开火上下结构念什么| 石棉是什么东西| 陈宝国的儿子叫什么| 硒对身体有什么好处| 闭经吃什么药| 镇宅是什么意思| 晚上搬家有什么说法| 什么情况下需做肠镜| 躺下就头晕是什么原因| 男人喜欢什么姿势| 老放臭屁是什么原因| 什么相处| 2月24号是什么星座| 2017年五行属什么| 榴莲和什么食物相克| 睚眦必报是什么意思| ca199偏高是什么意思| 梦见桥断了是什么意思| 肺栓塞是什么意思| 猫鼻支是什么症状| 近视和远视有什么区别| 0mg是什么意思| 牙杀完神经为什么还疼| 神经内科和神经外科有什么区别| 张若昀原名叫什么| 口腔溃疡吃什么食物| 间接胆红素是什么| 猫吃什么食物除了猫粮| 胃胀气用什么药最好| 佛口蛇心是什么生肖| 喝什么降尿酸| 肺结节钙化是什么意思| 女生有美人尖代表什么| 女生肚脐眼下面疼是什么原因| 胃胀吃什么药| 子宫低回声结节是什么意思| 念珠菌性阴道炎有什么症状| 什么叫介入手术| 圣女是什么意思| l是什么字| 女孩第一次来月经需要注意什么| 蓝灰色配什么颜色好看| cj什么意思| 晚上11点到12点是什么时辰| 聪明的人有什么特征| 桂附地黄丸治什么病| 单亲家庭是什么意思| adh医学上是什么意思| 新生儿满月打什么疫苗| 牙齿疼是什么原因引起的| 滚球是什么意思| 螃蟹喜欢吃什么食物| 家财万贯是什么动物| 九月七日是什么星座| 充气娃娃是什么| 卡卡是什么意思| 哪吒妈妈叫什么名字| 玉和石头有什么区别| 无可厚非什么意思| 脚掌麻木是什么原因| 小囊性灶是什么意思| 看见乌鸦有什么预兆| 胰腺炎为什么血糖高| 背影杀是什么意思| 派出所长是什么级别| 胆汁反流有什么症状| 嘴唇干裂脱皮是什么原因| 痔疮用什么药膏最好| 国家是什么| 猫咪疫苗什么时候打| 公主是什么意思| 1221是什么星座| 9.1什么星座| 荷花代表什么| 白月光是什么意思| 什么牌子的氨糖好| 护士规培是什么意思| 五月二十日是什么日子| 求婚什么意思| 中性粒细胞计数偏高是什么意思| 什么样的情况下需要做肠镜| 菲律宾货币叫什么| 肚子疼用什么药好| 偏头痛挂什么科| 变化无常的意思是什么| 老鼠最怕什么| 什么人容易得白肺病| 什么食物含锌多| 禳是什么意思| 长沙有什么区| 血压低压高吃什么药| 黄油是什么| 母鸡是什么意思| 气管炎吃什么药好| 乳腺疼挂什么科| 格五行属什么| 拉稀是什么原因| 放电是什么意思| 放屁多吃什么药| 性功能下降是什么原因| 长颈鹿吃什么树叶| 白白的云朵像什么| 七月是什么生肖| 辛弃疾字什么| 12月8日是什么星座| 国行是什么意思| degaia是什么牌子| 颌下淋巴结肿大吃什么药| 记忆力下降是什么原因引起的| 正常的包皮什么样子| 诱因是什么意思| 什么叫骨折| 心肌缺血吃什么食物好| 糖尿病人吃什么水果好| 芒果和什么榨汁好喝| 男人胡子长得快是什么原因| 醋酸菌是什么菌| xo是什么酒| 磷高有什么症状和危害| 一什么圆月| 嘴巴发麻是什么原因| 阴道内壁是什么样的| 为什么癌症治不好| 司令员是什么军衔| 男性性功能下降是什么原因| 胰岛素的作用是什么| 抗氧化是什么意思| 尿道炎挂什么科| 财星是什么意思| 眼泪多是什么原因| 吃什么食物可以去湿气| 五官指什么| 雪青色是什么颜色| 屋尘螨和粉尘螨是什么| 产后吃什么水果好| 小孩咳嗽喝什么药| 蛋白粉什么时间喝最好| 阿司匹林治什么病| 脾是什么| 食管裂孔疝什么意思| 眉毛里有痣代表什么| 地包天是什么意思| 百度Jump to content

最新英镑技术分析_4月18日投行英镑汇率走势分析

From Wikipedia, the free encyclopedia
百度 参加“青年红色筑梦之旅”活动的项目可自主选择参加主赛道或“青年红色筑梦之旅”赛道比赛。

In computer programming, a declaration is a language construct specifying identifier properties: it declares a word's (identifier's) meaning.[1] Declarations are most commonly used for functions, variables, constants, and classes, but can also be used for other entities such as enumerations and type definitions.[1] Beyond the name (the identifier itself) and the kind of entity (function, variable, etc.), declarations typically specify the data type (for variables and constants), or the type signature (for functions); types may also include dimensions, such as for arrays. A declaration is used to announce the existence of the entity to the compiler; this is important in those strongly typed languages that require functions, variables, and constants, and their types to be specified with a declaration before use, and is used in forward declaration.[2] The term "declaration" is frequently contrasted with the term "definition",[1] but meaning and usage varies significantly between languages; see below.

Declarations are particularly prominent in languages in the ALGOL tradition, including the BCPL family, most prominently C and C++, and also Pascal. Java uses the term "declaration", though Java does not require separate declarations and definitions.

Declaration vs. definition

[edit]

One basic dichotomy is whether or not a declaration contains a definition: for example, whether a variable or constant declaration specifies its value, or only its type; and similarly whether a declaration of a function specifies the body (implementation) of the function, or only its type signature.[1] Not all languages make this distinction: in many languages, declarations always include a definition, and may be referred to as either "declarations" or "definitions", depending on the language.[a] However, these concepts are distinguished in languages that require declaration before use (for which forward declarations are used), and in languages where interface and implementation are separated: the interface contains declarations, the implementation contains definitions.[b]

In informal usage, a "declaration" refers only to a pure declaration (types only, no value or body), while a "definition" refers to a declaration that includes a value or body. However, in formal usage (in language specifications), "declaration" includes both of these senses, with finer distinctions by language: in C and C++, a declaration of a function that does not include a body is called a function prototype, while a declaration of a function that does include a body is called a "function definition". In Java declarations occur in two forms. For public methods they can be presented in interfaces as method signatures, which consist of the method names, input types and output type. A similar notation can be used in the definition of abstract methods, which do not contain a definition. The enclosing class can be instantiated, rather a new derived class, which provides the definition of the method, would need to be created in order to create an instance of the class. Starting with Java 8, the lambda expression was included in the language, which could be viewed as a function declaration.

Declarations and definitions

[edit]

In the C-family of programming languages, declarations are often collected into header files, which are included in other source files that reference and use these declarations, but don't have access to the definition. The information in the header file provides the interface between code that uses the declaration and that which defines it, a form of information hiding. A declaration is often used in order to access functions or variables defined in different source files, or in a library. A mismatch between the definition type and the declaration type generates a compiler error.

For variables, definitions assign values to an area of memory that was reserved during the declaration phase. For functions, definitions supply the function body. While a variable or function may be declared many times, it is typically defined once (in C++, this is known as the One Definition Rule or ODR).

Dynamic languages such as JavaScript or Python generally allow functions to be redefined, that is, re-bound; a function is a variable much like any other, with a name and a value (the definition).

Here are some examples of declarations that are not definitions, in C:

extern char example1;
extern int example2;
void example3(void);

Here are some examples of declarations that are definitions, again in C:

char example1; /* Outside of a function definition it will be initialized to zero.  */
int example2 = 5;
void example3(void) { /* definition between braces */ }

Undefined variables

[edit]

In some programming languages, an implicit declaration is provided the first time such a variable is encountered at compile time. In other languages, such a usage is considered to be an error, which may result in a diagnostic message. Some languages have started out with the implicit declaration behavior, but as they matured they provided an option to disable it (e.g. Perl's "use strict" or Visual Basic's "Option Explicit").

See also

[edit]

Notes

[edit]
  1. ^ For example, Java uses "declaration" (class declaration, method declaration), while Python uses "definition" (class definition, function definition).[3]
  2. ^ This distinction is observed in Pascal "units" (modules), and in conventional C and C++ code organization, which has header files consisting largely of pure declarations, and source files consisting of definitions, though this is not always strictly observed, nor enforced by the language.

References

[edit]
  1. ^ a b c d "A declaration specifies the interpretation and attributes of a set of identifiers. A definition of an identifier is a declaration for that identifier that:
    • for an object [variable or constant], causes storage to be reserved for that object;
    • for a function, includes the function body;
    • for an enumeration constant, is the (only) declaration of the identifier;
    • for a typedef name, is the first (or only) declaration of the identifier."
    C11 specification, 6.7: Declarations, paragraph 5.
  2. ^ Mike Banahan. "2.5. Declaration of variables". GBdirect. Retrieved 2025-08-07. [A] declaration [...] introduces just the name and type of something but allocates no storage[...].
  3. ^ 7. Compound statements, The Python Language Reference
[edit]
梦见被雷劈什么意思 便秘吃什么 龟头炎用什么药膏 头上长虱子什么原因引起的 养牛仔裤是什么意思
praal00是什么型号 夏天用什么泡脚最好 一字马是什么意思 小孩出汗多是什么原因造成的 怔忡是什么意思
头发油的快是什么原因 搬家当天有什么讲究 8月5日什么星座 老流鼻血是什么原因引起的 来月经喝什么好
耕的左边读什么 剑玉是什么 刘五行属性是什么 双相情感障碍吃什么药 充军是什么意思
安全监察是一种带有什么的监督hcv9jop6ns1r.cn 红色加蓝色是什么颜色hcv9jop6ns2r.cn 电灯泡什么意思hcv8jop0ns5r.cn 金刚菩提是什么植物的种子cl108k.com 大学硕士点是什么意思hcv7jop5ns0r.cn
温度计里面红色液体是什么hcv7jop5ns6r.cn 拔胡子有什么危害1949doufunao.com 无意识是什么意思hcv8jop1ns5r.cn 断档是什么意思hcv9jop2ns2r.cn 胆囊壁不光滑是什么意思0735v.com
云南白药里的保险子有什么作用hcv8jop4ns6r.cn 789是什么意思hcv9jop2ns7r.cn 取环后要注意什么事项travellingsim.com 卵巢囊性回声什么意思hcv7jop9ns1r.cn 祛湿吃什么食物hcv8jop6ns9r.cn
什么是绩效工资chuanglingweilai.com 地中海贫血是什么意思hcv8jop2ns5r.cn 匹马棉是什么面料hcv9jop4ns6r.cn 压床娃娃有什么讲究吗xinjiangjialails.com dha中文叫什么hcv8jop2ns7r.cn
百度