AutosarC++18_10-A2.13.5ΒΆ
Hexadecimal constants should be upper case
Required inputs: IR
| Level | advisory |
|---|---|
| Target | implementation |
| Enforcement | automated |
Rationale
Using upper case literals for hexadecimal constants makes the source code consistent in this matter and removes a potential developer confusion.
Example
//% $Id: A2-13-5.cpp 305629 2018-01-29 13:29:25Z piotr.serwa $
#include <cstdint>
int main(void)
{
std::int16_t a = 0x0f0f; //non-compliant
std::int16_t b = 0x0f0F; //non-compliant
std::int16_t c = 0x0F0F; //compliant
return 0;
}
See Also
- JSF December 2005 [8]: AV Rule 150: Hexadecimal constants will be represented using all uppercase letters.
Possible Messages
Key |
Text |
Severity |
Disabled |
|---|---|---|---|
hex_literal |
Hexadecimal constants should be upper case. |
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
This rule has no individual options.