[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 06:32:52 UTC 2018


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

Stanislav Blinov <stanislav.blinov at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
                 CC|                            |stanislav.blinov at gmail.com
         Resolution|FIXED                       |---

--- Comment #2 from Stanislav Blinov <stanislav.blinov at gmail.com> ---
>From http://man7.org/linux/man-pages/man3/malloc.3p.html :

Upon successful completion with size not equal to 0, malloc() shall return a
pointer to the allocated space. If size is 0, either a null pointer or a unique
pointer that can be successfully passed to free() shall be returned. Otherwise,
it shall return a null pointer and set errno to indicate the error.

I.e. just checking for 0 result is insufficient to make the failure call.

--


More information about the Digitalmars-d-bugs mailing list