How can I remove C style casting in rtwtypes.h
Answers (1)
0 votes
Hi @Troy,
I checked the MathWorks documentation, and it looks like there isn’t a built-in way to generate *rtwtypes.h` using `static_cast<>*. The file is intentionally C-compatible, so it uses traditional C-style casts like (int8_T)(127) to ensure it works across compilers and platforms.
There are a few ways people handle the compiler warnings:
1. Suppress the warning for that header file—most compilers let you disable “old-style cast” warnings selectively.
2. Wrap the include with pragmas that temporarily disable the warning.
3. Manually edit `rtwtypes.h` to use `static_cast<>`, but you’d need to redo this every time the code is regenerated.
The cleanest approach in a workflow that regenerates code often ends up being either warning suppression or using pragmas, so you don’t have to maintain a custom header.
Keep me posted if you made any progress.
Categories
Find more on Deployment, Integration, and Supported Hardware in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!