c const 不斷跟新

2022-03-15 07:46:47 字數 701 閱讀 2881

1.把乙個 const 物件的位址賦給乙個普通的、非 const 物件的指標也會導致

編譯時的錯誤:

const

double pi = 3.14

;double *ptr = π //

error: ptr is a plain pointer

const

double *cptr = π //

ok: cptr is a pointer to const

2.不能使用 void* 指標(第 4.2.2 節)儲存 const 物件的位址,而必須使

const

int universe = 42

;const

void *cpv = &universe; //

ok: cpv is const

void *pv = &universe; //

error: universe is const

3.允許把非 const 物件的位址賦給指向 const 物件的指標,不能修改其值

double dval = 3.14; //

dval is a double; its value can be changed

cptr = &dval; //

ok: but can't change dval through cptr

字串系列函式 不斷跟新

1.sprintf,sprintf s sprintf char buffer,const char format,argument vs下需要加上 crt secure no warnings include using namespace std intmain 這個貌似是典型的緩衝區溢位,程式...

AssetBundle版本跟新對比

文字格式 獲取res資料夾下所有檔案的相對路徑和md5值 string files directory.getfiles respath,searchoption.alldirectories stringbuilder versions newstringbuilder string extens...

Spring boot學習demo(持續跟新)

這個 倉庫主要儲存的是springboot學習中的一些demo mybaitsdemo 是springboot mybaits redisdemo是springboot redis springboot restful是spring boot restful風格訪問 json springboot ...