Top Qs
Timeline
Chat
Perspective
Name collision
Computing error resulting from the use of identically-named variables From Wikipedia, the free encyclopedia
Remove ads
In computer programming, a name collision is the nomenclature problem that occurs when the same variable name is used for different things in two separate areas that are joined, merged, or otherwise go from occupying separate namespaces to sharing one. As with the collision of other identifiers, it must be resolved in some way[a] for the new software (such as a mashup) to work right.[1] Problems of name collision, and methods to avoid them, are a common issue in an introductory level analysis of computer languages, such as for C++.[1]
![]() | It has been suggested that Naming collision be merged into this article. (Discuss) Proposed since June 2025. |
Remove ads
History
The term "name collision" has been used in computer science for more than three decades, when referring to names in various classification systems.[2]
Avoiding name collisions
There are several techniques for avoiding name collisions, including the use of:
- namespaces - to qualify each name within a separate name group, so that the totally qualified names differ from each other.[1]
- renaming - to change the name of one item (typically the one used less often) into some other name.
- prefixing - putting unique characters before the names so that the names differ and further name collisions are unlikely to happen by accident.
Remove ads
See also
- Local variables, variable data items that are local to a module
- Name mangling
- Naming collision
Notes
- see hash table#Collision_resolution for details
References
Wikiwand - on
Seamless Wikipedia browsing. On steroids.
Remove ads