san*_*p22 3 c static constants function memory-address
像下面这样在 C 中返回静态常量变量的地址是否安全?
uint8_t *return_static_const_addr(void) { static const uint8_t values[2] = {0x01, 0x02}; return values; }
Bor*_*d81 5
它在运行时会有一个常量地址,所以,是的,它是安全的。
归档时间:
5 年,11 月 前
查看次数:
181 次
最近记录: