変数_(プログラミング)
[Wikipedia|▼Menu]
□記事を途中から表示しています
[最初から表示]

注釈^ C17規格までのC言語およびC++03規格までのC++において、auto修飾されたローカル変数は自動記憶域期間を持つ自動変数になるが、ローカル変数は既定で自動変数となるため、autoキーワードは通例使われない。なおC++において、C++11規格以降はautoキーワードの意味が変更されており、型推論のプレースホルダーに使われる。C言語においても、C23規格以降はautoキーワードの意味が変更され、型推論のプレースホルダーに使われるようになる予定である[13]
^ いわゆるオブジェクト指向におけるオブジェクトではなく、プログラミング言語で値を表すものや、メモリ上にあるデータ(メモリオブジェクト)などといったものの総称である。
^ C言語のリンケージ指定の用法におけるstaticキーワードの対義語はexternキーワードである。グローバル変数や関数はデフォルトで外部リンケージであり、他のソースファイルからもそれらの「宣言」を記述するだけでアクセスできるようになるが、宣言をextern修飾することで外部リンケージであることを明確に示すこともできる。不完全型の外部リンケージ変数宣言の場合はextern修飾は必須ではないが、完全型の外部リンケージ変数宣言の場合は定義と区別するためにextern修飾が必須となる。externキーワードは通例ヘッダーファイルで前方宣言する際に使用される[11]

出典^ bit 編集部『bit 単語帳』共立出版、1990年8月15日、229頁。.mw-parser-output cite.citation{font-style:inherit;word-wrap:break-word}.mw-parser-output .citation q{quotes:"\"""\"""'""'"}.mw-parser-output .citation.cs-ja1 q,.mw-parser-output .citation.cs-ja2 q{quotes:"「""」""『""』"}.mw-parser-output .citation:target{background-color:rgba(0,127,255,0.133)}.mw-parser-output .id-lock-free a,.mw-parser-output .citation .cs1-lock-free a{background:url("//upload.wikimedia.org/wikipedia/commons/6/65/Lock-green.svg")right 0.1em center/9px no-repeat}.mw-parser-output .id-lock-limited a,.mw-parser-output .id-lock-registration a,.mw-parser-output .citation .cs1-lock-limited a,.mw-parser-output .citation .cs1-lock-registration a{background:url("//upload.wikimedia.org/wikipedia/commons/d/d6/Lock-gray-alt-2.svg")right 0.1em center/9px no-repeat}.mw-parser-output .id-lock-subscription a,.mw-parser-output .citation .cs1-lock-subscription a{background:url("//upload.wikimedia.org/wikipedia/commons/a/aa/Lock-red-alt-2.svg")right 0.1em center/9px no-repeat}.mw-parser-output .cs1-ws-icon a{background:url("//upload.wikimedia.org/wikipedia/commons/4/4c/Wikisource-logo.svg")right 0.1em center/12px no-repeat}.mw-parser-output .cs1-code{color:inherit;background:inherit;border:none;padding:inherit}.mw-parser-output .cs1-hidden-error{display:none;color:#d33}.mw-parser-output .cs1-visible-error{color:#d33}.mw-parser-output .cs1-maint{display:none;color:#3a3;margin-left:0.3em}.mw-parser-output .cs1-format{font-size:95%}.mw-parser-output .cs1-kern-left{padding-left:0.2em}.mw-parser-output .cs1-kern-right{padding-right:0.2em}.mw-parser-output .citation .mw-selflink{font-weight:inherit}ISBN 4-320-02526-1。 
^ EXP33-C. 初期化されていないメモリからの読み込みを行わない
^ ごく初期のC言語(UNIXバージョン6の頃)では違うが。[要出典]
^ 「動的スコープ」という用語自体が誤った名称 (misnomer) である、という指摘がある https://www.cs.cmu.edu/Groups/AI/html/cltl/clm/node43.html
^ "The lifetime of an object is the portion of program execution during which storage is guaranteed to be reserved for it." ISO/IEC 9899:2017. p.30.
^ "An object exists, has a constant address, ... and retains its last-stored value throughout its lifetime." ISO/IEC 9899:2017. p.30.
^ "If an object is referred to outside of its lifetime, the behavior is undefined" ISO/IEC 9899:2017. p.30.
^ ISO/IEC 9899、JIS X 3010「プログラム言語C」、ISO/IEC 14882、JIS X 3014「プログラム言語C++」を参照。
^ 3. Scope and Extent 。Common Lisp the Language, 2nd Edition
^ ECMA-334 "C# Language Specification"、JIS X 3015「プログラム言語C#」、Microsoft Docs(日/英)などを参照。
^ a b 記憶域クラス指定子 (C) - cppreference.com
^ 記憶域クラス指定子 (C++) - cppreference.com
^ C23 - cppreference.com
^ 例えばPHPのマニュアルに「Another important feature of variable scoping is the static variable. A static variable exists only in a local function scope, but it does not lose its value when program execution leaves this scope.」( ⇒http://php.net/manual/en/language.variables.scope.php#language.variables.scope.static) とあるのは、エクステントについて議論しているのにエクステントの語が無く、この記述では混同されているものと見られる[独自研究?]。

関連項目

定数 (プログラミング)

自由変数と束縛変数

配列

定数

参照透過性

引数

参照 (情報工学)

命名規則 (プログラミング)

変数 (数学)

識別子

プログラム変数

記事の検索
おまかせリスト
▼オプションを表示
ブックマーク登録
mixiチェック!
Twitterに投稿
オプション/リンク一覧
話題のニュース
列車運行情報
暇つぶしWikipedia

Size:28 KB
出典: フリー百科事典『ウィキペディア(Wikipedia)
担当:undef