/ˈɛkstɜːrn ˈkiːwɜːrd/
EXtern KEYword
externは「エクスターン」、keywordは「キーワドゥ」のように発音します。プログラミングの専門用語のため、英語のネイティブスピーカーでもプログラミングに詳しくない人は聞き慣れない可能性があります。どちらの単語も最初の音節に強勢を置きます。
"In computer programming, particularly in languages like C and C++, the 'extern' keyword is used to declare a variable or function that has external linkage, meaning its definition exists in another source file or globally."
ニュアンス・使い方
このフレーズは、プログラミング言語の特定の文法要素を指す専門用語です。日常会話で使われることはなく、ソフトウェア開発や情報科学の分野での技術的な議論、コードの記述、または技術文書でのみ使用されます。変数が他のファイルで定義されていることをコンパイラに知らせることで、複数のファイルにまたがる大規模なプログラムの構築を可能にします。その性質上、非常にフォーマルで技術的な文脈に限定されます。ネイティブのプログラマーは、コードのモジュール性やコンパイルの仕組みを理解するためにこの概念を頻繁に利用します。
We need to use the 'extern' keyword when declaring a global variable in a header file.
ヘッダーファイルでグローバル変数を宣言する際には、'extern'キーワードを使用する必要があります。
The 'extern' keyword tells the compiler that the function's actual definition is in another source file.
'extern'キーワードは、その関数の実際の定義が別のソースファイルにあることをコンパイラに伝えます。
If you omit the 'extern' keyword for a global variable, it will be defined multiple times when linking.
グローバル変数に対して'extern'キーワードを省略すると、リンク時に複数回定義されてしまいます。
Understanding the 'extern' keyword is crucial for multi-file C programming.
マルチファイルCプログラミングでは、'extern'キーワードを理解することが不可欠です。
My professor explained the 'extern' keyword in detail during the C programming lecture.
教授がCプログラミングの講義中に'extern'キーワードについて詳しく説明してくれました。
Can you show me an example of how to properly use the 'extern' keyword?
'extern'キーワードの正しい使い方を例で示していただけますか?
I'm still a bit confused about the difference between declaring and defining with the 'extern' keyword.
'extern'キーワードを使った宣言と定義の違いがまだ少し混乱しています。
The compiler error indicated an issue related to the 'extern' keyword linkage.
コンパイラのエラーは、'extern'キーワードのリンケージに関連する問題を示していました。
Always ensure that a variable declared with 'extern' keyword is defined exactly once in your project.
'extern'キーワードで宣言された変数は、プロジェクト内で一度だけ定義されていることを常に確認してください。
The course material covers the advanced usage of the 'extern' keyword.
このコースの教材には、'extern'キーワードの高度な使用法が含まれています。
staticキーワードは、主に変数や関数のスコープや生存期間を限定するために使われます。externは「外部からの参照を許可する」のに対し、staticは「内部でのみ使用可能」という、対照的な概念を持つことがあります。
volatileキーワードは、変数が最適化によって変更されないようにコンパイラに指示するために使われます。externがリンケージに関連するのに対し、volatileはメモリへのアクセス方法に関連します。
constキーワードは、変数が定数であることを宣言し、その値が変更されないようにするために使われます。externが外部参照に関連するのに対し、constは値の不変性に関連します。
'extern'キーワードは、外部リンケージを持つグローバル変数や関数に対して使用されます。関数内のローカル変数には適用できません。
'extern'キーワードで宣言された変数は、プロジェクト内で一度だけ実体を定義する必要があります。複数回定義するとリンケージエラーが発生します。
'extern'キーワードは、主に静的リンケージやコンパイル単位間でのシンボルの可視性に関連します。動的リンキング(DLLsやShared Libraries)とは異なる概念です。
A:
How do I share a global variable across multiple C files?
複数のCファイル間でグローバル変数を共有するにはどうすればいいですか?
B:
You should declare it in a header file using the 'extern' keyword, and then define it once in one of your source files.
ヘッダーファイルで'extern'キーワードを使って宣言し、その変数をいずれかのソースファイルで一度だけ定義すればよいです。
A:
I noticed you used 'extern' for a local variable here. That's not correct.
ここでローカル変数に'extern'を使っていますね。それは正しくありません。
B:
Oh, my mistake. I thought it helped with scope management. Thanks for pointing that out.
ああ、私の間違いです。スコープ管理に役立つと思っていました。指摘ありがとうございます。