Why does using reserved keywords as Stateflow local data identifiers not cause code generation to fail with an error?
3 次查看(过去 30 天)
显示 更早的评论
MathWorks Support Team
2019-12-4
回答: MathWorks Support Team
2020-3-4
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?
采纳的回答
MathWorks Support Team
2019-12-4
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 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Simulink Functions 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!