Boost logo

Boost :

Subject: Re: [boost] [align] Review - Impl Evaluation Part 1.
From: Marc Glisse (marc.glisse_at_[hidden])
Date: 2014-04-12 05:46:16


On Sat, 12 Apr 2014, Mostafa wrote:

> #########################################################
> align/detail/aligned_alloc_{android,msvc,posix,sunos}.hpp
> #########################################################
>
> What happens when "size" parameter is 0? According to "boost::aligned_alloc"
> specs it should return a null pointer. This also seems to be the behaviour of
> aligned_alloc on both msvc and posix, but sunos maybe different (consult the
> table below). On sunos there is a possibility that the current implementation
> of aligned_alloc as found in aligned_alloc_sunos might return a non-null
> pointer, in contravention of "boost::aligned_alloc" specs. If so the code
> needs to be fixed.

http://pubs.opengroup.org/onlinepubs/9699919799/functions/posix_memalign.html
says that for size 0, the return may be either null or a unique pointer (since
2008). C11 says the same about the aligned_alloc function.

Old freebsd used to assert that the size argument was != 0.

-- 
Marc Glisse

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk