Why is the limits.h header file included when there are fixed point data types in an AUTOSAR model?

13 次查看(过去 30 天)
I have an AUTOSAR model that includes fixed point data types. When preprocessor directives for fixed point word size checks are enabled, in the generated file " modelName_private.h," I see the following line as part of the fixed point word size checks.
#include <limits.h>
In AUTOSAR, the data type definitions for the CRL are defined in "Mfx.h" header.
What is the difference between "limits.h" and "Mfx.h"? Why is the "limits.h" file included for AUTOSAR models with fixed point data types?

采纳的回答

MathWorks Support Team
From section 5.1 of the AUTOSAR standard, the "header file Mfx.h provides all public function prototypes and types defined by the Mfx library specification."
The “limits.h” header file is unrelated to the CRL or AUTOSAR at all – it determines the limits (max and min values that can be represented) for variable types.
This header file is included when there are fixed point data types in the model and fixed-point word size checks are enabled. Please note that "limits.h" is not generated by MathWorks Coder products but rather is a C header file that determines the limits for different variable types. The limit for each type is the max and min values that can be represented by the type. 
The reason why we include this header file is to perform some checks on the target (e.g., because fixpoint slope/bias can cause overflow). These checks can be disabled with the setting

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 AUTOSAR Blockset 的更多信息

产品


版本

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by