AutosarC++18_03-A2.13.5ΒΆ

Hexadecimal constants should be upper case

Required inputs: IR

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 [7]: 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