好词典

namespace

UK //ˈneɪmspeɪs//US //ˈneɪmspeɪs//

词源

Compound of 'name' + 'space', first used in programming contexts in the late 20th century.

noun

❶ 命名空间是编程中用于区分不同代码块中相同名称的标识符的机制,避免命名冲突。

“In C++, you can define a namespace to organize your code.”

(在C++中,你可以定义一个命名空间来组织代码。)

“The 'std' namespace contains all the standard library functions in C++.”

('std'命名空间包含了C++中的所有标准库函数。)

同义词:scope, context, domain

常见短语

namespace pollution — 命名空间污染指在全局命名空间中定义了过多的变量或函数,导致命名冲突和代码混乱。

“Avoid namespace pollution by using proper scoping and namespaces.”

(通过使用适当的作用域和命名空间来避免命名空间污染。)