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: OndÅej BÃlka <neleai at seznam dot cz>
- To: Will Newton <will dot newton at linaro dot org>
- Cc: Paul Eggert <eggert at cs dot ucla dot edu>, libc-alpha <libc-alpha at sourceware dot org>, Patch Tracking <patches at linaro dot org>
- Date: Thu, 7 Nov 2013 19:48:09 +0100
- 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> <CANu=DmiyupjQqKYf4pzxR4xd5PwNUV+Gqgtv8N8SNV94F56CSw at mail dot gmail dot com> <527BC886 dot 3090202 at cs dot ucla dot edu> <CANu=DmhVkHbgc3jhTDGbUZ3EC9UoGkPhuMhdV68nhfVbYANGaQ at mail dot gmail dot com>
On Thu, Nov 07, 2013 at 05:37:59PM +0000, Will Newton wrote:
> On 7 November 2013 17:06, Paul Eggert <eggert@cs.ucla.edu> wrote:
> > On 11/07/2013 12:33 AM, Will Newton wrote:
> >> 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.
> >
> > This is mainly because posix_memalign has been there for
> > years and aligned_alloc is new. The newer interface is clearly better,
> > and the documentation shouldn't recommend the worse interface.
>
> True, but the question of which is "better" also involves which is
> more portable to currently deployed systems IMO, and I do not have a
> feel for whether aligned_alloc is actually out there and usable on a
> wide variety of systems. C11 is only a couple of years old and only in
> the last few years have we seen a widespread push to use C99 idioms
> and even now there are projects that avoid C99.
>
Portability depends on tools available. As one can by configure script
#define aligned_alloc memalign
portability is not issue here.
As heretic thougth issue here is that changing configure scripts takes
time and skill and most of time is duplication of work.
Somebody should create and maintain a autoautoconf project that would
generate header with compatibility definitions of functions that are not
present.
Second part is that converting to new interfaces also should be easy but
is not. Converting from obsolete functions to new ones is a repetive
task so there should be a program to do it.
These transformations should be easily done by coccinelle (example for
bzero is below), it is matter of writing collection of transformations,
put it in one place and propagate it to get used.
@@ expression e1, e2; @@
- bzero (e1, e2)
+ memset (e1, 0, e2)