[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gnulib-bug
Subject:    [Bug-gnulib] fwd: obstack default alignment
From:       Benno <benjl () cse ! unsw ! edu ! au>
Date:       2004-08-10 1:34:07
Message-ID: 20040810013407.GG862 () cse ! unsw ! edu ! au
[Download RAW message or body]


Hi,

This originally went to the glibc list. It was suggested
I copy here as more people might actually the obstack functions.

Cheers,

Benno

----- Forwarded message from Benno <benjl@cse.unsw.edu.au> -----

Date: Tue, 10 Aug 2004 09:35:54 +1000
From: Benno <benjl@cse.unsw.edu.au>
Subject: obstack default alignment
Message-ID: <20040809233554.GX862@cse.unsw.edu.au>
To: libc-alpha@sources.redhat.com
User-Agent: Mutt/1.5.6i

There appears to be inconsistency in the alignment of memory returned
by different memory allocation routines in libc. Specifically malloc
is defined to allocate memory that is aligned to hold any data type.
(Which to me seems to be sane behaviour.)

By constrast obstack_alloc is defined to return memory aligned to 4 bytes.
*But* it actually calculates default alignmnet to be big enough to hold a
double (which is often the largest alignment needed, but not on Itanium).

I would have thought it made sense to set the default alignment in the same
way as malloc(). However failing shouldn't the code actually implement the
docs and set the alignment to 4, rather than calculating?

Cheers,

Benno

----- End forwarded message -----



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic