このページの内容は最新ではありません。最新版の英語を参照するには、ここをクリックします。
識別子
コード ジェネレーターでコードの構造の識別子を生成する方法を設定できます。識別子の命名規則を使用して、わかりやすい、一意の、追跡可能な識別子を生成します。
生成された識別子の最大長を制御し、名前マングリング テキストを含めて名前の競合を回避できます。トークン デコレータを使用して正規表現を使用する識別子のコンテンツを制御します。C および C++ からのキーワードなど、特定のキーワードは識別子として無効です。
関数
RTW.reservedIdentifiers | Get reserved identifiers for code generation (R2023b 以降) |
トピック
- Identifier Format Control
You can customize generated identifiers by using identifier naming rules. An identifier naming rule consists of a macro that contains a combination of literal text, tokens, and token decorators. The code generator replaces the tokens in the macro with certain text values depending on the type of token. For example, use the
$R
token to insert the root model name into an identifier. You can use token decorators to modify the expanded values of 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. - 予約キーワード
コード ジェネレーターを使用して C または C++ コードを生成する場合、モデルには内部使用のために予約されているキーワードが含まれていてはなりません。
- Avoid Identifier Naming Collisions
Use model configuration parameters and best practices to avoid identifier collisions and maintain traceability in generated code.