AutosarC++18_03-A0.4.2¶
Type long double shall not be used
Required inputs: IR
| Level | required |
|---|---|
| Target | implementation |
| Enforcement | automated |
Rationale
The width of long double type, and therefore width of the significand, is implementation-defined.
The width of long double type can be either:
- 64 bits, as the C++14 Language Standard allows long double to provide at leastas much precision as type double does, or
- 80 bits, as the IEEE 754 standard allows extended precision formats (see:Extended-Precision-Format), or
- 128 bits, as the IEEE 754 standard defines quadruple precision format
Example
//% $Id: A0-4-2.cpp 289436 2017-10-04 10:45:23Z michal.szczepankiewicz $
void Fn() noexcept {
float f1{0.1F}; // Compliant
double f2{0.1}; // Compliant
long double f3{0.1L}; // Non-compliant
}
See Also
- none
Possible Messages
Key |
Text |
Severity |
Disabled |
|---|---|---|---|
type_used |
The type shall not be used. |
None |
False |
Options¶
This rule shares the following common options: confidence, exclude_in_macros, exclude_messages_in_system_headers, excludes, extend_exclude_to_macro_invocations, includes, justification_checker, languages, post_processing, provider, report_at, severity
The following places define options that affect this rule: Stylechecks, Analysis-GlobalOptions
forbidden_types¶
forbidden_types : set[bauhaus.ir.LIR_Class_Name] = {'C_Long_Double_Type'}
C_Long_Double_Type.