Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> How did you get from "That way" to thinking I claimed that C, by default, handles allocation failures?

I think you might want to reread the line you quoted directly above this,

That way of writing code, i.e. "write[ing] code that handles OOM conditions gracefully" "is the default [...] in C".

This is what I am saying is not the case. The default in C is undefined behavior (libc) or crashing (a significant fraction of projects allocator wrappers). Not "handling OOM gracefully" - i.e. handling OOM errors.





> I think you might want to reread the line you quoted directly above this,

I am reading exactly what I said:

> You can write code that handles OOM conditions gracefully, but that way of writing code is the default only in C.

How is it possible to read that as anything other than "That Way Of Writing Code Is The Default Way In C"?

Are you saying that checking the result of malloc (and others) is not the default way of allocating memory?


> Are you saying that checking the result of malloc (and others) is not the default way of allocating memory?

In C - yes. I've said that repeatedly now...


>> Are you saying that checking the result of malloc (and others) is not the default way of allocating memory?

> In C - yes. I've said that repeatedly now...

Well, that's just not true. The instances of unchecked allocations are both few and far between, *and* treated as bugs when reported :-/

Maybe you should program in a language for a little bit before forming an opinion on it :-/


I have programmed in C plenty. Your assertion that unchecked allocations are few and far between is simply entirely incorrect. That they are treated as bugs when reported is incorrect in most C software.

For good reason. Most C software is not designed to run in a situation where malloc might fail.

I, unlike you, have provided evidence of this by pointing to major pieces of the linux desktop that do not do so.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: