Jump to content

Talk:C Programming/Memory Management

Page contents not supported in other languages.
Add topic
From Wikiversity
Latest comment: 5 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 source]

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