Main Content

RTW.reservedIdentifiers

Get reserved identifiers for code generation

Since R2023b

Description

example

[c, cpp] = RTW.reservedIdentifiers() returns structures that contain lists of reserved keywords. If your model uses a reserved keyword as an identifier, then the code generator attempts to replace that keyword when it generates identifiers in the code. Use the RTW.reservedIdentifiers() function to retrieve the list of keywords that the code generator attempts to replace.

Examples

collapse all

Retrieve reserved identifiers that the code generator attempts to replace.

[c, cpp] = RTW.reservedIdentifiers()
c = 

  struct with fields:

       reservedWords: {103×1 cell}
           fileNames: {29×1 cell}
    namesInLibraries: {1112×1 cell}


cpp = 

  struct with fields:

       reservedWords: {42×1 cell}
           fileNames: {85×1 cell}
    namesInLibraries: {1112×1 cell}

Output Arguments

collapse all

C reserved identifiers, returned as a struct.

The struct contains these fields.

Field NameDescription
reservedWordsKeywords that the code generator reserves because the C language specification reserves them, returned as a cell array. The code generator attempts to replace these if the model uses them as identifiers.
fileNamesKeywords that the code generator reserves because they match the names of C standard library files, returned as a cell array. The MATLAB® Coder™ code generator attempts to rename generated files that match these keywords. You can use keywords that appear in only this field as identifiers. The Simulink® Coder and Embedded Coder® code generators do not perform this check.
namesInLibrariesKeywords that the code generator reserves because they are used in commonly used libraries, returned as a cell array. The code generator attempts to replace these if the model uses them as identifiers. This list is shared between C and C++ and is returned in full in each struct.

C++ reserved identifiers, returned as a struct.

The struct contains these fields.

Field NameDescription
reservedWordsKeywords that the C++ code generator reserves because the C++ language specification reserves them, returned as a cell array. The code generator attempts to replace these if the model uses them as identifiers. This list does not include keywords that the C language specification reserves, but the C++ code generator attempts to replace those keywords as well.
fileNamesKeywords that the code generator reserves because they match the names of C++ standard library files, returned as a cell array. The MATLAB Coder code generator attempts to rename generated files that match these keywords. You can use keywords that appear in only this field as identifiers. The Simulink Coder and Embedded Coder code generators do not perform this check. This list does not include filenames from the C standard library, but the C++ code generator attempts to replace those filenames as well.
namesInLibrariesKeywords that the code generator reserves because they are used in commonly used libraries, returned as a cell array. The code generator attempts to replace these if the model uses them as identifiers. This list is shared between C and C++ and is returned in full in each struct.

Version History

Introduced in R2023b

See Also