Why does using reserved keywords as Stateflow local data identifiers not cause code generation to fail with an error?

3 views (last 30 days)

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 4 Dec 2019
There is a distinction between how Simulink identifiers interact with reserved keywords and how Stateflow local data identifiers interact with reserved keywords. If you use a reserved keyword as an identifier in Simulink, code generation will fail with an error. However, if you use a reserved keyword as an identifier for local data in Stateflow, code generation will succeed, but the keyword will not be used in the generated code (instances of the keyword will be renamed). Adding a user-specified reserved name to configset's "Reserved names" box will cause an error when it conflicts with a Simulink identifier but will only cause a rename when it conflicts with a Stateflow local data identifier.
Note that C code generation is only concerned with C reserved keywords and code generation reserved keywords. C++ reserved keywords are ignored in this situation.
As I previously mentioned, adding user-defined reserved names to the configset option will cause an error when these keywords conflict with Simulink identifiers. There is no way to cause this same behavior for Stateflow local data identifiers.
Note that there are some additional reserved keywords for Stateflow. For further details, please refer to the following documentation page:

More Answers (0)

Categories

Find more on Simulink Functions in Help Center and File Exchange

Products


Release

No release entered yet.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!