Talk:C Programming/Memory Management

Latest comment: 4 years ago by ThaniosAkro in topic Warning under "Allocating Memory"

In C, the return from malloc should NOT be cast to a type; that is incorrect and it is considered a bad practice! In C++ it is the correct practice, in C it is not. This battle was fought in the 1980s and it is not still being fought; there is a single clear answer, and that is that it is incorrect to cast the return value from malloc().67.171.216.14 (discuss) 20:46, 16 January 2019 (UTC)Reply

Warning under "Allocating Memory" edit

Current version is :

"which won't allocate any memory for you. Worse, it might return a null pointer, but that's not guaranteed. This means that it's possible"

Should this read:

"which won't allocate any memory for you. Worse, the null pointer is not guaranteed. It might return a valid pointer to 0 bytes. This means that it's possible"

ThaniosAkro (discusscontribs) 15:15, 3 November 2019 (UTC)Reply

Return to "C Programming/Memory Management" page.