This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH 2/2] manual/memory.texi: Document aligned_alloc.
- From: Will Newton <will dot newton at linaro dot org>
- To: Paul Eggert <eggert at cs dot ucla dot edu>
- Cc: libc-alpha <libc-alpha at sourceware dot org>, Patch Tracking <patches at linaro dot org>
- Date: Thu, 7 Nov 2013 08:33:57 +0000
- Subject: Re: [PATCH 2/2] manual/memory.texi: Document aligned_alloc.
- Authentication-results: sourceware.org; auth=none
- References: <527A6F4E dot 4020006 at linaro dot org> <527A95D5 dot 2060604 at cs dot ucla dot edu>
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