This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 2/2] manual/memory.texi: Document aligned_alloc.


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]