このページの内容は最新ではありません。最新版の英語を参照するには、ここをクリックします。
識別子
コード ジェネレーターでコードの構造の識別子を生成する方法を設定できます。識別子の命名規則を使用して、わかりやすい、一意の、追跡可能な識別子を生成します。モデル コンフィギュレーション セット、コード マッピング エディター、および Embedded Coder® ディクショナリで識別子の命名規則を使用できます。
生成された識別子の最大長を制御し、名前マングリング テキストを含めて名前の競合を回避できます。トークン デコレータを使用して正規表現を使用する識別子のコンテンツを制御します。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. For information about how to modify the expanded values, see Modify Identifier Format Tokens by Using Token Decorators. - Modify Identifier Format Tokens by Using Token Decorators
Specify modifications to expanded values of identifier format tokens.
- boolean とデータ型制限の識別子の指定
boolean の
false
とtrue
に対応する識別子を指定することで生成コードを独自のコードと統合する。また、生成コードでオーバーフローの判別に使用されるデータ型制限に対応する識別子を指定する。 - 予約キーワード
コード ジェネレーターを使用して C または C++ コードを生成する場合、モデルには内部使用のために予約されているキーワードが含まれていてはなりません。
- Avoid Identifier Naming Collisions
Use model configuration parameters and best practices to avoid identifier collisions and maintain traceability in generated code.