我在下面的代码中收到警告,即
uint64_t val = 0x1234567812345678;
uint32_t addr = 0x12345678;
*(volatile uint64_t *)(addr) = val;
$gcc -o test test.c test.c: In function ‘main’: test.c:8:4: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] *(volatile uint64_t *)(addr) = val;
它是一个嵌入式环境,并尝试实现Flash算法,其中只能编程双字。 将uint32_t addr转换为uint64_t易失性地址的最佳方法是什么?