Main Content

Identifier Name Collisions and Mangling

In identifier generation, a circumstance that would cause generation of two or more identical identifiers is called a name collision. When a potential name collision exists, unique name-mangling text is generated and inserted into each of the potentially conflicting identifiers. Each set of name-mangling characters is unique for each generated identifier.

Identifier Name Collisions with Referenced Models

Referenced models can introduce additional naming constraints. Within a model that uses referenced models, collisions between the names of the models cannot exist. When you generate code from a model that includes referenced models, the Maximum identifier length parameter must be large enough to accommodate the root model name and name-mangling text. A code generation error occurs if Maximum identifier length is too small.

When a name conflict occurs between an identifier within the scope of a higher-level model and an identifier within the scope of a referenced model, the identifier from the referenced model is preserved. Name mangling is performed on the identifier from the higher-level model.

For more information on referenced models, see Parameterize Instances of a Reusable Referenced Model.