[PATCH 2/2] manual/memory.texi: Document aligned_alloc.
Will Newton
will.newton@linaro.org
Thu Nov 7 08:34:00 GMT 2013
On 6 November 2013 19:17, Paul Eggert <eggert@cs.ucla.edu> wrote:
> Looks pretty good. Some suggestions:
>
>> +This function was introduced in @w{ISO C11} and hence may have better
>> +portability to modern non-POSIX systems than @code{posix_memalign}.
>
> A similar note should be put in posix_memalign's documentation.
> Something like this, perhaps?
>
> Although this function is superseded by @code{aligned_alloc}, it was
> standardized in POSIX.1-2004 and is more portable to older POSIX
> systems that do not support @w{ISO C11}.
Ok.
>> -power of two than that, use @code{posix_memalign}. @code{posix_memalign}
>> -is declared in @file{stdlib.h}.
>> +power of two than that, use @code{posix_memalign} or
>> +@code{aligned_alloc}. @code{posix_memalign} and @code{aligned_alloc}
>> +are declared in @file{stdlib.h}.
>
> I would mention only aligned_alloc here; now that we have it, there's
> no reason to recommend posix_memalign.
Perhaps, but I would rather get consensus on this. The majority of
code out there seems to be using posix_memalign and it is not
deprecated (i.e. it remains in currently applicable standards).
aligned_alloc seems pretty much unused AFAICT.
>> -The @code{memalign} function is obsolete and @code{posix_memalign} should
>> -be used instead.
>> +The @code{memalign} function is obsolete and @code{posix_memalign} or
>> +@code{aligned_alloc} should be used instead.
>
> Likewise here.
>
>> -The @code{valloc} function is obsolete and @code{posix_memalign} should
>> -be used instead.
>> +The @code{valloc} function is obsolete and @code{posix_memalign} or
>> +@code{aligned_alloc} should be used instead.
>
> And here.
>
>> +The value of this variable is a pointer to function that @code{aligned_alloc},
>> +@code{memalign}, @code{posix_memalign} and @code{valloc} use whenever they
>> +are called. You should define this function to look like @code{memalign};
>
> Change the last 'memalign' to 'aligned_alloc'.
The hook is called "__memalign_hook" so I'm not sure how much of an
improvement that is but I'll change it.
Thanks for the review!
--
Will Newton
Toolchain Working Group, Linaro
More information about the Libc-alpha
mailing list