Re: [PATCH] Reimplement aligned_alloc
Szabolcs Nagy <[email protected]>
| Newsgroups | gmane.comp.lib.newlib |
|---|---|
| Message-ID | <[email protected]> |
The 05/19/2020 19:41, Sebastian Huber wrote: > Hello, > > On 19/05/2020 11:52, Szabolcs Nagy wrote: > > - Failed to set errno on error. > why should aligned_alloc() set errno on error? iso c allows standard api calls to set errno (except not to 0) but usually does not specify error conditions, however posix does and requires allocation functions to set errno to ENOMEM on failure. posix is not yet aligned with c11 so there is no errno specification for aligned_alloc but that does not mean newlib should make it deliberately inconsistent with other allocation functions, users will try to use perror or strerror when calls fail that may internally use aligned_alloc and expect reasonable error message.