This is the mail archive of the 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: improving malloc

On Sat, Jan 05, 2013 at 11:42:58PM +0000, Joseph S. Myers wrote:
> On Sat, 5 Jan 2013, Rich Felker wrote:
> > Read the text of the response
> > ( The
> > requirement is only that (void *)(T *)p == p for any p returned by
> > malloc. This is true even if the pointer is not aligned in the "value
> No, that's just an example from the question and the answer; the 
> requirement is to be suitably aligned for any (standard) type.

"Suitably aligned for any standard type" is not something a conforming
program can test for. The definition of suitable alignment that the C
standard is working with pertains only to the ability to (1) convert
pointer types, and (2) access an object of the type with the alignment
requirement without invoking UB. The latter cannot apply if the
allocated object is too small for the type, so only the requirements
of the former (non-destructive pointer conversions) need to be

With that said, I think arguing about this here is rather off-topic,
and I think you've made up your mind about how glibc treats and will
continue to treat the issue. However, there's at least major room for
disagreement as to whether it's a conformance issue or glibc policy,
and the DR you cited does not provide any final word on the issue.


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