Why does using reserved keywords as Stateflow local data identifiers not cause code generation to fail with an error?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
MathWorks Support Team
am 4 Dez. 2019
Beantwortet: MathWorks Support Team
am 4 Mär. 2020
I am using a reserved keyword from the link below as a local data identifier in Stateflow:
https://www.mathworks.com/help/ecoder/ug/reserved-keywords.html
Why does code generation succeed?
Akzeptierte Antwort
MathWorks Support Team
am 4 Dez. 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:
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Simulink Functions finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!