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 rule is classified as:
|
Was this page helpful?
Your message has been sent. We will email you at
If you do not see the email in your inbox, please check if it is filtered to one of the following folders: