Identifiers
You can configure how the code generator generates identifiers for code structures. Use identifier naming rules to generate identifiers that are meaningful, unique, and traceable. You can use identifier naming rules in the model configuration set, Code Mappings Editor, and Embedded Coder® Dictionary.
You can control the maximum length of generated identifiers and include name-mangling text to avoid name collisions. You can use token decorators to control the content of an identifier using regular expressions. Certain keywords are not valid as identifiers, such as keywords from C and C++.
Functions
RTW.reservedIdentifiers | Get reserved identifiers for code generation (Since R2023b) |
Topics
- Identifier Format Control
You can customize generated identifiers by using identifier naming rules.
- Modify Identifier Format Tokens by Using Token Decorators
Specify modifications to expanded values of identifier format tokens.
- Specify Boolean and Data Type Limit Identifiers
Integrate the generated code with your code by specifying the identifiers that correspond to Boolean
false
andtrue
. Also, specify the identifiers that correspond to data type limits, which the generated code uses to determine overflows. - Reserved Keywords
If you use the code generator to produce C or C++ code, your model must not contain keywords that are reserved for internal use.
- Avoid Identifier Naming Collisions
Use model configuration parameters and best practices to avoid identifier collisions and maintain traceability in generated code.