天天看點

d假裝d頭常是可變的

​​原文​​ 如下無法編譯:

// test.c
static int *do_something(int * const p){
  int * const data = p;
  *data = 2; // 錯誤:無法修改`'*data'常'`表達式
  return 0;
}//從sqlite中化簡.      

不知道該怎麼辦,因為​

​const​

​​在​

​ImportC​

​​中是​

​傳遞性​

​的.

保持現狀或忽略​

​常​

​​都​

​錯誤​

​​,但這允許更多​

​正确​

​​的程式​

​成功編譯​

​.