Our website uses cookies to enhance your browsing experience.
Accept
to the top
>
>
>
V2523. MISRA. All integer constants...
menu mobile close menu
Additional information
toggle menu Contents

V2523. MISRA. All integer constants of unsigned type should have 'u' or 'U' suffix.

Nov 19 2018

This diagnostic rule is based on the software development guidelines developed by MISRA (Motor Industry Software Reliability Association).

The analyzer has detected an unsigned integer literal without a 'U' / 'u' suffix ('U' in C++). Such literals obscure the code as their type is ambiguous. Besides, the same literals can be of different types in various data models.

Using suffixes to explicitly specify the type helps to avoid ambiguity when reading numeric literals.

Here is an example of code triggering the warning (provided that the literal is of unsigned type on the platform under analysis):

auto typemask = 0xffffffffL;

This diagnostic is classified as:

  • MISRA-C-2012-7.2
  • MISRA-C-2023-7.2
  • MISRA-CPP-2008-2.13.3