[Issue 19164] malloc may be considered pure when failure results in program exit (no need to reset errno)

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Nov 18 08:06:19 UTC 2018


https://issues.dlang.org/show_bug.cgi?id=19164

--- Comment #6 from Stanislav Blinov <stanislav.blinov at gmail.com> ---
If it was only to improve already existing code, it should've been done there
locally for that code. But these are made for the whole package. For longevity,
changing semantics of malloc isn't a good design decision. If anyone in five
years time adds something else to Phobos that uses those functions, how are
they to know they shouldn't pass 0 to them? Essentially, as implemented,
enforceMalloc may terminate the program on a valid input.

It's not that passing 0 to malloc is a useful thing to do. But since it allows
it, a wrapper shouldn't fail with it either.

--


More information about the Digitalmars-d-bugs mailing list