Const (computer programming): Difference between revisions

Content deleted Content added
G™✓
Tags: Reverted Visual edit Mobile edit Mobile web edit
m Reverted 1 edit by 174.250.210.174 (talk) to last revision by OlliverWithDoubleL
Line 1:
{{short description|Type qualifier denoting the data as being read-only}}
{{lowercase title}}
[[L2 Puppis|Wambat]]<ref>{{Cite web |date=https://github.com/jekyll/jekyll-import/issues/479 |title=Drill |url=}}</ref>{{lowercase title}}
 
In some [[programming language]]s, '''const''' is a [[type qualifier]] (a [[Keyword (computer programming)|keyword]] applied to a [[data type]]) that indicates that the data is read-only. While this can be used to declare [[Constant (computer programming)|constants]], {{mono|const}} in the [[List of C-family programming languages|C family]] of languages differs from similar constructs in other languages in being part of the ''type,'' and thus has complicated behavior when combined with [[Pointer (computer programming)|pointers]], references, [[composite data type]]s, and [[type-checking]]. In other languages, the data is not in a single [[memory ___location]], but copied at [[compile time]] on each use.<ref>{{Cite web |title=Constant items - The Rust Reference |url=https://doc.rust-lang.org/reference/items/constant-items.html |access-date=2022-06-22 |website=doc.rust-lang.org}}</ref> Languages which utilize it include [[C (programming language)|C]], [[C++]], [[D (programming language)|D]], [[JavaScript]], [[Julia (programming language)|Julia]], and [[Rust (programming language)|Rust]].