Reading view

There are new articles available, click to refresh the page.

人再笨还能写不出内存安全的 C?

nlzy:

人再笨还能学不会空指针不能解引用?

人再笨还能学不会超出存储期的对象的指针不能解引用?

人再笨还能学不会 alloc 出来的指针需要 free 一次?

人再笨还能学不会 alloc 出来的指针不能越界读取和写入?

人再笨还能学不会 malloc 出来的内存需要初始化才能读取?

人再笨还能学不会 free 只能用在 alloc 出来的指针上?

人再笨还能学不会 free'ed / realloc'ed 的指针不能再次 free ?

人再笨还能学不会重用 free'ed / realloc'ed 的存储是未定义行为?

人再笨还能学不会 realloc 返回 NULL 时原有指针仍需 free 一次?

人再笨还能学不会 memcpy memmove 的目标缓冲区的大小需要足够大?

人再笨还能学不会 memcpy 的两段内存区域不能重叠?

人再笨还能学不会 strcpy strlen puts printf("%s"...) 只能用在带 '\0' 终结符的字符串上?

...

❌