Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

assert ( malloc...

Name: Anonymous 2010-06-28 13:36

A question for you, Anon.

If you watch at malloc() manpage you can notice that the function may return NULL in some cases (i.e. errors or 0-sized allocation). How do you face this issue?

I noticed that many programmers check the return value and manage error routines for it, while other just assert() the return value not to be NULL.

Also in C++ by the way you use the new operator without taking care about the return value (I guess it's asserted to be not NULL under the hood, is it?)

What is your opinion?

Name: Anonymous 2010-06-29 11:05

>>29
Yeah pretty much.
Really? I thought he was trolling. Dynamic memory allocation is very important in my opinion. It's so important that people have spent quite a lot of time working on components to handle the process so you don't have to.

Name: Anonymous 2010-06-29 13:26

Enjoy your AIDS AND FAIL, /prog/

Name: Anonymous 2010-06-29 14:07

>>34
You should be able to see where that got us.

Name: Anonymous 2010-06-29 14:29

>>36
I'm glad you live in a world where you can know everything that's going to happen before it happens, but I live in the real world where things are unpredictable, and systems need to be put in place to accommodate for uncertainty.

Name: Anonymous 2010-06-29 14:36

>>37
In many systems you can know what sizes your inputs will have, in other cases, you will probably have to use some dynamic allocation.

Name: Anonymous 2010-06-29 14:48

>>34 Yeah, Dynamiic memory allocation IS important.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List