タグ

software-engineeringとvariableに関するnabinnoのブックマーク (2)

  • Variable shadowing - Wikipedia

    In computer programming, variable shadowing occurs when a variable declared within a certain scope (decision block, method, or inner class) has the same name as a variable declared in an outer scope. At the level of identifiers (names, rather than variables), this is known as name masking. This outer variable is said to be shadowed by the inner variable, while the inner identifier is said to mask

  • グローバル変数 - Wikipedia

    グローバル変数(大域変数、英: global variable)は、コンピュータプログラミングにおいて全てのスコープからアクセスできる変数のことである。グローバル変数の寿命は、プログラムの生存期間と同じである。対する語は、ローカル変数である。スコープも参照。 概要[編集] 一般にグローバル変数は、その非局在的な性質ゆえに、悪い作法だと考えられている。すなわち、グローバル変数は潜在的にどこかで変更される可能性があり、またプログラムの一部はそれに依存してしまう恐れがあるからである。グローバル変数はそれゆえ相互依存を生み出す無限の可能性を持っており、相互依存が高まることは複雑性を増大することにつながる。遠隔作用(英語版) (action at a distance) を参照。 しかしグローバル変数が適する状況もある。例えば、システム起動時に一度だけファイルから読み出し、以降は様々な関数を通して継

  • 1