News for hackers. Stuff that matters.
Re:C Programming Guidelines by userbinator on Wednesday September 02, 2015 @01:24AM (#10157573)
For memory allocation you often don't need to use malloc.

True.

Many (most?) programs can mmap a large region of memory and allocate from that.

You don't even need to do that for many applications. Coming from an embedded systems background where dynamic allocation is highly discouraged and almost never necessary, the amount of superfluous allocation/deallocation I see in a lot of code is astounding; maybe it's because of my experience, but I can often very easily find a way to do something without dynamic allocation and consequently O(n) space, with what usually turns out to be simpler (thus less chance of being buggy) code and O(1) space.

But when you do need dynamic allocation, malloc() isn't bad at all.

Re:C Programming Guidelines by jeffreyrogers on Wednesday September 02, 2015 @09:48AM (#10159082)
This is a very good point.