Reserved Keywords

Generator keywords are reserved for internal use. Do not use them in models as identifiers or function names. Also avoid using C reserved keywords in models as identifiers or function names. If your model contains reserved keywords, code generation does not complete and an error message appears. To address the error, modify your model to use identifiers or names that are not reserved.

If you use the code generator to produce C++ code, your model must not contain the Reserved Keywords for Code Generation nor the C++ Reserved Keywords.

Note

You can register additional reserved identifiers in the Simulink® environment. For more information, see Specify Reserved Names for Generated Identifiers.

C Reserved Keywords

autodoubleintstruct
breakelselongswitch
caseenumregistertypedef
charexternreturnunion
constfloatshortunsigned
continueforsignedvoid
defaultgotosizeofvolatile
doifstaticwhile

C++ Reserved Keywords

catchfriendprotectedtry
classinlinepublictypeid
const_castmutablereinterpret_casttypename
deletenamespacestatic_castusing
dynamic_castnewtemplatevirtual
explicitoperatorthiswchar_t
exportprivatethrow 

Reserved Keywords for Code Generation

absint8_TMAX_uint8_T*rtInf
asmint16_TMAX_uint16_T*rtMinusInf
boolint32_TMAX_uint32_T*rtNaN
boolean_Tint64_TMAX_uint64_TSeedFileBuffer
byte_TINTEGER_CODEMIN_int8_T*SeedFileBufferLen
char_TLINK_DATA_BUFFER_SIZEMIN_int16_T*single
cint8_TLINK_DATA_STREAMMIN_int32_T*TID01EQ
cint16_TlocalBMIN_int64_Ttime_T
cint32_TlocalCMODELtrue
creal_TlocalDWorkMTuint_T
creal32_TlocalPNCSTATESuint8_T
creal64_TlocalXNULLuint16_T
cuint8_TlocalXdisNUMSTuint32_T
cuint16_TlocalXdotpointer_Tuint64_T
cuint32_TlocalZCEPROFILING_ENABLED UNUSED_PARAMETER
ERTlocalZCSVPROFILING_NUM_SAMPLESUSE_RTMODEL
falsematrixreal_TVCAST_FLUSH_DATA
fortranMAX_int8_T*real32_Tvector
HAVESTDIOMAX_int16_T*real64_T 
id_tMAX_int32_T*RT 
int_TMAX_int64_TRT_MALLOC 
*Not reserved if you specify a replacement identifier.

Code Generation Code Replacement Library Keywords

The list of code replacement library reserved keywords for your development environment varies depending on which libraries are registered. The list of available code replacement libraries varies depending on other installed products (for example, a target product), or if you used Embedded Coder® to create and register custom code replacement libraries.

To generate a list of reserved keywords for libraries currently registered in your environment, use the following MATLAB® function:

lib_ids = RTW.TargetRegistry.getInstance.getTflReservedIdentifiers()

This function returns an array of library keywords. Specifying the input argument is optional.

Note

To list the libraries currently registered in your environment, use the MATLAB command crviewer.

To generate a list of reserved keywords for a specific library that you are using to generate code, call the function passing the name of the library as displayed in the Code replacement library menu on the Code Generation > Interface pane of the Configuration Parameters dialog box. For example,

lib_ids = RTW.TargetRegistry.getInstance.getTflReservedIdentifiers('GNU C99 extensions')

Here is a partial example of the function output:

>> lib_ids = ...
   RTW.TargetRegistry.getInstance.getTflReservedIdentifiers('GNU C99 extensions')

lib_ids = 

    'exp10'
    'exp10f'
    'acosf'
    'acoshf'
    'asinf'
    'asinhf'
    'atanf'
    'atanhf'
...
    'rt_lu_cplx'
    'rt_lu_cplx_sgl'
    'rt_lu_real'
    'rt_lu_real_sgl'
    'rt_mod_boolean'
    'rt_rem_boolean'
    'strcpy'
    'utAssert'

Note

Some of the returned keywords appear with the suffix $N, for example, 'rt_atan2$N'. $N expands into the suffix _snf only if nonfinite numbers are supported. For example, 'rt_atan2$N' represents 'rt_atan2_snf' if nonfinite numbers are supported and 'rt_atan2' if nonfinite numbers are not supported. As a precaution, you should treat both forms of the keyword as reserved.