|
本帖最后由 guolun 于 2016-1-13 16:44 编辑
我在项目中加入easyFlash,编译时出现“Error[Pe513]: a value of type "void const *" cannot be assigned to an entity of type "uint8_t const *
出现错误的程序:uint32_t ef_calc_crc32(uint32_t crc, const void *buf, size_t size)
{
const uint8_t *p;
p = buf;
crc = crc ^ ~0U;
while (size--) {
crc = crc32_table[(crc ^ *p++) & 0xFF] ^ (crc >> 8);
}
return crc ^ ~0U;
}
我理解的意思是:buf 是void const* 类型,p 是const uint8_t* 类型,p = buf 操作不允许。
疑问1:常量指针buf为什么不定义为uint8_t类型?
疑问2:如果改 buf 为 uint8_t 类型,程序有什么影响?
|
阿莫论坛20周年了!感谢大家的支持与爱护!!
“你必须好好活下去,任何时候都不要失去勇气。我们都会走过这个困难的时代。” ——《黄河绝恋》(1999)
|