Reading a value from raw memory (MISRA compliant)
问题 I'm trying to read the value of a variable previously write on NVM flash. My code is: uintptr_t address = getAddress(); //[MISRA C++ Rule 5-2-8] cast from unsigned int to pointer uint16_t value = *(reinterpret_cast<uint16_t*>(address)); The problem is the cast from uintptr_t to pointer is not allowed in MISRA. Do anyone knows a way to access this memory? I'm breaking one of the big rules of MISRA. Using dynamic memory (the contents of flash is dynamic so the address of data is variable). Only