I'm just learning the Matlab coder to convert matlab code to c codes. Everything looks good but in the generated c codes the data type like real_T, int_T appare a lot of times. These are not regular data types of C language. I'm wondering do I have to change these in order to compile these codes in a c complier? Thanks.
No products are associated with this question.
The .h file will have the appropriate typedef .
Using typedef types such as real_T instead of float or double, makes it easier to generate code that can be compiled on different machines that might have different floating point properties. Instead of the C code generator having to know all the details of each machine, instead the code is generated in terms of "intent" of the section, and a machine-specific .h file translates the intents into local implementation details.
For example, if the code generated double directly, then to port the code to a different machine, you would need to know whether at that particular point in the code, "double" was needed for precision purposes; or if instead the original target machine only had "double" instructions in hardware and so "double" was being used for performance reasons; or if instead the code was needed to talk to an operating system interface that specifically expects 8 bytes exactly. But if the code generates real_T at that point then the intent becomes clear "whatever data type is handy to handle single precision or higher", which a target-specific .h file can then know is "float" or "double" as appropriate for the hardware instruction set, that the precision is not too important and the size representation is not too important. Change a single #define or a typedef and you are ready for a different hardware, without the code generation facility having to know anything about the very specific chip that will be compiled to.
Play games and win prizes!Learn more