宇舶手表什么档次| 阴道是什么意思| 尿出血是什么原因| 公筷是什么意思| 长孙皇后叫什么名字| 145什么意思| 驻京办是干什么的| 合肥有什么玩的| 琴棋书画指的是什么| 口腔溃疡是什么引起的| 骨髓不造血是什么病| 大红袍茶属于什么茶| 做梦梦见很多蛇是什么意思| plt医学上是什么意思| 梦见自己拉粑粑是什么意思| q波异常是什么意思| 2月19日什么星座| 血糖高吃什么降得快| 三头六臂是什么意思| 做美甲有什么危害| 如意丹的作用是什么| jb是什么意思| 梦见巨蟒是什么预兆| 肚脐眼的作用是什么| 什么是老年斑图片| 男人染上霉菌什么症状| 脚上长水泡是什么原因| 什么是修行人| kaws是什么牌子| 付诸行动是什么意思| 冬瓜炖什么好吃| 怀孕皮肤变差什么原因| 蓝加黄是什么颜色| enne是什么烟| 骨关节疼痛什么原因| 搬新家有什么讲究和准备的| 怀孕前检查什么项目内容| 高瞻远瞩是什么生肖| 和女生聊天聊什么| 做深蹲有什么好处| 为什么会腰疼| 马齿苋别名叫什么| 消防队属于什么编制| 独断万古是什么意思| 减肥期间可以吃什么零食| circle是什么意思| 眼球出血是什么原因引起的| 林俊杰的粉丝叫什么| 梦见大狼狗是什么意思| 黄芪和北芪有什么区别| 真丝丝绒是什么面料| 喝石斛水有什么禁忌| 随喜是什么意思| 下午两点是什么时辰| 耳朵后面有痣代表什么| 木加号读什么| 恙是什么意思| 樵是什么意思| 线性骨折是什么意思| 金牛座是什么星座| 谷氨酸钠是什么添加剂| 被蜈蚣咬了有什么症状| 豆工念什么| 胆固醇高吃什么好| 96年属什么的| 姨妈疼吃什么止疼药| 农历10月19日是什么星座| 两个克念什么| 蛇吐信子是什么意思| 氧化氢是什么| 共产主义社会是什么样的社会| ige高是什么意思| 离殇是什么意思| 为什么精液是黄色的| 甲状腺桥本是什么意思| 房性心动过速是什么意思| 学痞是什么意思| 太监是什么| 一朝一夕是什么意思| 蜗牛吃什么东西| 强直是什么意思| 繁花似锦是什么意思| 背影杀是什么意思| 十月初八是什么星座| 婴儿为什么喜欢趴着睡| 生理盐水是什么东西| 什么的海底| 对公转账是什么意思| 什么万| 鼓刹和碟刹有什么区别| ppada是什么牌子| 猫尿床是因为什么原因| 什么的森林| 属虎的守护神是什么菩萨| 内膜薄吃什么增长最快| 绞股蓝长什么样子| 什么是代孕| 622188开头是什么银行| 男人人中有痣代表什么| 梦见大棺材是什么预兆| 牙龈发黑是什么原因| 五行缺什么怎么查询| kenzo属于什么档次| 梦见猫什么意思| 梦见白菜是什么预兆| 脚趾甲发白是什么原因| 女性更年期挂什么科| 巡视员是什么级别| 龟头炎用什么药膏| 宫颈钙化灶是什么意思| 什么是躁郁症| lotus是什么意思| 清热去湿热颗粒有什么功效| burberry什么牌子| 女性尿频尿急挂什么科| 乌鸡白凤丸男性吃治疗什么| 耳根有痣代表什么| a9什么意思| 海鲜不能和什么水果一起吃| 精梳棉是什么面料| 冷笑话是什么意思| nicu是什么意思| 牙周康又叫什么名字| 百家姓第一个姓是什么| 抽筋什么原因| 皮上长小肉疙瘩是什么| 为什么高铁没有e座| 女人颧骨高有什么说法| 事不过三是什么意思| 体检应该挂什么科| butterfly什么意思| 头发大把大把的掉是什么原因| 小狗需要打什么疫苗| 六一送女孩子什么礼物| 古丽是什么意思| 泄泻什么意思| 400年前是什么朝代| 丙磺舒是什么药| 白事随礼钱有什么讲究| 生化妊娠后需要注意什么| 盆腔为什么有积液| 什么是裸分| 微针有什么功效| 山东人喜欢吃什么| 心理学属于什么学科| 全友床垫属于什么档次| 现实是什么意思| 一台什么| 吲哚美辛是什么药| o型血和b型血的孩子是什么血型| 猜忌是什么意思| 什么是有意义的东西| 肥肠炒什么菜好吃| 绝命是什么意思| 眼圈发黑什么原因| 食禄痣是什么意思| 子宫内膜增厚是什么原因引起的| it是什么意思| 工作单位是什么意思| 什么是借读生| 双数是什么| 肤浅是什么意思| 胎盘成熟度0级什么意思| 金银花有什么功效| 三什么什么什么成语| mc是什么意思| 梦到发洪水是什么征兆| 精液长什么样| 淋巴结肿大看什么科室最好| 什么茶属于绿茶| 蜗牛是什么动物| 5月25是什么星座| 室性逸搏是什么意思| 什么是精神| 打两个喷嚏代表什么| 儿童支原体感染吃什么药| 什么病不能吃竹笋| 产后大出血一般发生在什么时候| 他乡遇故知什么意思| 四月十五是什么星座| 为什么会出现眼袋| 周公解梦掉牙齿意味着什么| 非你莫属是什么意思| olay是什么档次| 手凉是什么原因| 孕酮低对胎儿有什么影响| 寿眉茶属于什么茶| 女人阴部黑是什么原因| 朋友梦到我怀孕了是什么意思| 孩子高烧不退是什么原因| 秋葵不能和什么一起吃| 碳水化合物是什么东西| 双相情感障碍什么意思| 违拗是什么意思| 为什么会发生地震| 1966年属什么今年多大| 定坤丹什么时候吃最好| 小个子适合什么发型| 项羽姓什么| 静脉注射是什么意思| 高等院校是什么意思| 油性皮肤适合用什么护肤品| 什么紫| 袖珍人是什么意思| 吃什么可以让胸部变大| 什么不及什么| 红色的补色是什么颜色| 什么是庞氏骗局| 目瞪口呆是什么生肖| 吃桑葚对身体有什么好处| 惊奇地什么| 汗疱疹是什么原因引起| 什么是聚酯纤维面料| 补充电解质是什么意思| 佛口蛇心是什么生肖| 女性寒性体质喝什么茶| 5月3日什么星座| 专硕和学硕有什么区别| 女人自尊心强说明什么| 肠镜前一天可以吃什么| 秉承是什么意思| 园字五行属什么| 肌红蛋白高是什么原因| 什么叫梅毒| 鳌虾吃什么| 无后为大的前一句是什么| 来姨妈喝什么比较好| 奥司他韦是什么药| 千山鸟飞绝的绝是什么意思| bpd是胎儿的什么意思| 下肢静脉曲张是什么原因引起的| 做喉镜挂什么科| 大腿肿胀是什么原因| 腰痛看什么科| 尿液浑浊是什么原因| 宝宝发烧拉肚子是什么原因| 西洋参什么季节吃最好| 查抗体是做什么检查| 怀男孩和女孩有什么区别| 笨拙是什么意思| 渡情劫是什么意思| 前列腺是什么器官| 汗青是什么意思| 心有戚戚焉什么意思| 儿童尿频什么原因引起的| 上唇肿胀是什么原因| 墙内开花墙外香是什么意思| 如如不动是什么意思| 男左女右是什么意思| c反应蛋白偏高是什么原因| 孜孜不倦什么意思| 毛囊炎用什么药| 为什么会得阑尾炎| 星芒是什么意思| 麦冬长什么样| 牛蛙不能和什么一起吃| 心什么什么什么| 打磨工是做什么的| 血管钙化是什么意思| 布洛芬吃多了有什么后果| 结核是什么| 什么是电商平台| 磕头虫吃什么| 毫无保留什么意思| 百度Jump to content

浪漫樱花季 杜嘉班纳2017高定秀找寻你的婚纱灵感

From Wikipedia, the free encyclopedia
百度 周恩来同志是近代以来中华民族的一颗璀璨巨星,是中国共产党人的一面不朽旗帜。

In computer programming, one of the many ways that programming languages are colloquially classified is whether the language's type system makes it strongly typed or weakly typed (loosely typed). However, there is no precise technical definition of what the terms mean and different authors disagree about the implied meaning of the terms and the relative rankings of the "strength" of the type systems of mainstream programming languages.[1] For this reason, writers who wish to write unambiguously about type systems often eschew the terms "strong typing" and "weak typing" in favor of specific expressions such as "type safety".

Generally, a strongly typed language has stricter typing rules at compile time, which implies that errors are more likely to happen during compilation. Most of these rules affect variable assignment, function return values, procedure arguments and function calling. Dynamically typed languages (where type checking happens at run time) can also be strongly typed. In dynamically typed languages, values, rather than variables, have types.

A weakly typed language has looser typing rules and may produce unpredictable or even erroneous results or may perform implicit type conversion at runtime.[2] A different but related concept is latent typing.

History

[edit]

In 1974, Barbara Liskov and Stephen Zilles defined a strongly typed language as one in which "whenever an object is passed from a calling function to a called function, its type must be compatible with the type declared in the called function."[3] In 1977, K. Jackson wrote, "In a strongly typed language each data area will have a distinct type and each process will state its communication requirements in terms of these types."[4]

Definitions of "strong" or "weak"

[edit]

A number of different language design decisions have been referred to as evidence of "strong" or "weak" typing. Many of these are more accurately understood as the presence or absence of type safety, memory safety, static type-checking, or dynamic type-checking.

"Strong typing" generally refers to use of programming language types in order to both capture invariants of the code, and ensure its correctness, and definitely exclude certain classes of programming errors. Thus there are many "strong typing" disciplines used to achieve these goals.

Implicit type conversions and "type punning"

[edit]

Some programming languages make it easy to use a value of one type as if it were a value of another type. This is sometimes described as "weak typing".

For example, Aahz Maruch observes that "Coercion occurs when you have a statically typed language and you use the syntactic features of the language to force the usage of one type as if it were a different type (consider the common use of void* in C). Coercion is usually a symptom of weak typing. Conversion, on the other hand, creates a brand-new object of the appropriate type."[5]

As another example, GCC describes this as type-punning and warns that it will break strict aliasing. Thiago Macieira discusses several problems that can arise when type-punning causes the compiler to make inappropriate optimizations.[6]

There are many examples of languages that allow implicit type conversions, but in a type-safe manner. For example, both C++ and C# allow programs to define operators to convert a value from one type to another with well-defined semantics. When a C++ compiler encounters such a conversion, it treats the operation just like a function call. In contrast, converting a value to the C type void* is an unsafe operation that is invisible to the compiler.

Pointers

[edit]

Some programming languages expose pointers as if they were numeric values, and allow users to perform arithmetic on them. These languages are sometimes referred to as "weakly typed", since pointer arithmetic can be used to bypass the language's type system.

Untagged unions

[edit]

Some programming languages support untagged unions, which allow a value of one type to be viewed as if it were a value of another type.

Static type-checking

[edit]

In Luca Cardelli's article Typeful Programming,[7] a "strong type system" is described as one in which there is no possibility of an unchecked runtime type error. In other writing, the absence of unchecked run-time errors is referred to as safety or type safety; Tony Hoare's early papers call this property security.[8]

Variation across programming languages

[edit]

Some of these definitions are contradictory, others are merely conceptually independent, and still others are special cases (with additional constraints) of other, more "liberal" (less strong) definitions. Because of the wide divergence among these definitions, it is possible to defend claims about most programming languages that they are either strongly or weakly typed. For instance:

  • Java, Pascal, Ada, and C require variables to have a declared type, and support the use of explicit casts of arithmetic values to other arithmetic types. Java, C#, Ada, and Pascal are sometimes said to be more strongly typed than C, because C supports more kinds of implicit conversions, and allows pointer values to be explicitly cast while Java and Pascal do not. Java may be considered more strongly typed than Pascal as methods of evading the static type system in Java are controlled by the Java virtual machine's type system. C# and VB.NET are similar to Java in that respect, though they allow disabling of dynamic type checking by explicitly putting code segments in an "unsafe context". Pascal's type system has been described as "too strong", because the size of an array or string is part of its type, making some programming tasks very difficult. However, Delphi fixes this issue.[9][10]
  • Smalltalk, Ruby, Python, and Self are all "strongly typed" in the sense that typing errors are prevented at runtime and they do little implicit type conversion, but these languages make no use of static type checking: the compiler does not check or enforce type constraint rules. The term duck typing is now used to describe the dynamic typing paradigm used by the languages in this group.
  • The Lisp family of languages are all "strongly typed" in the sense that typing errors are prevented at runtime. Some Lisp dialects like Common Lisp or Clojure do support various forms of type declarations[11] and some compilers (CMU Common Lisp (CMUCL)[12] and related) use these declarations together with type inference to enable various optimizations and limited forms of compile time type checks.
  • Standard ML, F#, OCaml, Haskell, Go and Rust are statically type-checked, but the compiler automatically infers a precise type for most values.
  • Assembly language and Forth can be characterized as untyped. There is no type checking; it is up to the programmer to ensure that data given to functions is of the appropriate type.

See also

[edit]

References

[edit]
  1. ^ "What to know before debating type systems | Ovid [blogs.perl.org]". blogs.perl.org. Retrieved 2025-08-06.
  2. ^ "CS1130. Transition to OO programming. – Spring 2012 --self-paced version". Cornell University, Department of Computer Science. 2005. Archived from the original on 2025-08-06. Retrieved 2025-08-06.{{cite web}}: CS1 maint: bot: original URL status unknown (link)
  3. ^ Liskov, B; Zilles, S (1974). "Programming with abstract data types". ACM SIGPLAN Notices. 9 (4): 50–59. CiteSeerX 10.1.1.136.3043. doi:10.1145/942572.807045.
  4. ^ Jackson, K. (1977). "Parallel processing and modular software construction". Design and Implementation of Programming Languages. Lecture Notes in Computer Science. Vol. 54. pp. 436–443. doi:10.1007/BFb0021435. ISBN 3-540-08360-X.
  5. ^ Aahz. "Typing: Strong vs. Weak, Static vs. Dynamic". Retrieved 16 August 2015.
  6. ^ "Type-punning and strict-aliasing - Qt Blog". Qt Blog. Retrieved 18 February 2020.
  7. ^ Luca Cardelli, "Typeful programming"
  8. ^ Hoare, C. A. R. 1974. Hints on Programming Language Design. In Computer Systems Reliability, ed. C. Bunyan. Vol. 20 pp. 505–534.
  9. ^ InfoWorld. 2025-08-06. Retrieved 16 August 2015.
  10. ^ Kernighan, Brian (1981). "Why Pascal is not my favorite programming language". Archived from the original on 2025-08-06. Retrieved 2025-08-06.
  11. ^ "CLHS: Chapter 4". Retrieved 16 August 2015.
  12. ^ "CMUCL User's Manual: The Compiler". Archived from the original on 8 March 2016. Retrieved 16 August 2015.
尿道口灼热感吃什么药最快 弯脚杆是什么意思 1995属什么生肖 经常犯困是什么原因 脚真菌感染用什么药最好
舌苔厚腻是什么原因 牙周炎是什么 呵呵代表什么意思 鲣鱼是什么鱼 雅号是什么意思
见多识广是什么生肖 贫血吃什么药好 一个牙一个合是什么字 2018是什么生肖 什么酒不能喝
疤痕贴什么时候用最佳 人为什么要刷牙 胃寒能吃什么水果 低血压吃什么好 阶段性是什么意思
颈椎属于什么科室hcv8jop4ns7r.cn 月桂酸是什么hcv9jop6ns2r.cn dl是什么tiangongnft.com 天涯海角是什么生肖bjcbxg.com 脑炎是什么原因引起的hcv7jop7ns1r.cn
fred是什么牌子hcv8jop3ns3r.cn 124是什么意思0297y7.com poison是什么意思hcv8jop4ns9r.cn 十字架代表什么意思hcv9jop4ns5r.cn 慎用是什么意思hcv9jop5ns4r.cn
绝代双骄是什么意思hcv8jop2ns3r.cn 脸部爱出油是什么原因hcv8jop5ns7r.cn 糖原是什么hcv8jop6ns4r.cn 晕车喝什么hcv9jop1ns9r.cn 阑尾炎有什么症状0735v.com
背靠背协议是什么意思hcv8jop3ns8r.cn 食品科学与工程学什么hcv8jop1ns9r.cn 慢性支气管炎吃什么药好hcv7jop4ns5r.cn 今年28岁属什么hcv7jop4ns5r.cn 鲱鱼在中国叫什么鱼hcv8jop6ns0r.cn
百度