>
>
>
V2580. MISRA. The 'restrict' specifier …


V2580. MISRA. The 'restrict' specifier should not be used.

This diagnostic is based on the MISRA (Motor Industry Software Reliability Association) software development guide.

This rule only applies to programs written in C. The 'restrict' specifier is prohibited in variable declarations, functions' formal parameters, and structure/union fields. Although the compiler may be able to generate better-optimized code, using the 'restrict' specifier may lead to errors if two or more pointers refer to the same memory area.

Below is a code sample that triggers the analyzer's warnings:

void my_memcpy(void * restrict dest,
               const void * restrict src,
               size_t bytes)
{
  // ...
}

typedef struct
{
   void * restrict m_field;
} MyStruct;

This diagnostic is classified as:

  • MISRA-C-8.14