MISRA C++-2008 Rule 5-0-15 - Array indexing shall be the only form of pointer arithmetic
问题 I need someone who has more experience with MISRA to help me to solve this. I have the following code: byte* buf = new(std::nothrow) byte[bufferSize]; ..... for (uint32_t i = 0; i < bufferSize; i+=4) { .............. { buf[ i+0 ] = b; buf[ i+1 ] = g; buf[ i+2 ] = r; (1) Event misra_violation: [Required] MISRA C++-2008 Rule 5-0-15 violation: Array indexing shall be the only form of pointer arithmetic. buf[ i+3 ] = a; } MISRA Rule 5-0-15 doesn't allow also ptr++ or ptr--. What should be the