Re: [eigen] portable reallocation... |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] portable reallocation...
- From: Benoit Jacob <jacob.benoit.1@xxxxxxxxx>
- Date: Sun, 28 Feb 2010 07:46:14 -0500
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=5cfUI5i8tqwguZTM3+5gp7orgfDYr0ovNO97QpODtA4=; b=sz/vg9Mjg7UTcPIa19DmZuGbyUBvxPEJjRFEau7pp2Geiq8p0s4xP3pScH1AkJQwmw dppnbm1MSYPIGiCqtEDAR/gWIRKGS3gq4Q7+mTS5tN7h8+JWdc8k/6qkSOCehQUP0LNz O3DJgt4h+5V/snevz+O0hak+6b4s8mLs1m8GU=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=MOjuNd3HlQ7Hw4Pxo6D6YNIuvgVyusw9RRbLZh9PfPJAhvdhfY67xyQq5vtKuZsbYW mkuRJIFoeAy5ntMrqMvkw9eSbLNRNlOzkV37NQX9R+gWqGgIPbU2i2POfSix+CEFmUDD Tvy/sj12pbpLBK2Ef92Yz/YCQPjrZ41dNtZWE=
Great patch, just 1 comment:
- /*errno = ENOMEM;*/ // according to the standard we should set
errno = ENOMEM
+ errno = ENOMEM; // according to the standard
Isn't it std::errno? Recently someone complained that the standard
doesn't guarantee that the c++ headers will define these symbols in
the global namespace, only in the std namespace. Putting std::
everywhere was necessary to fix QNX/QCC compatibillity.
OH WAIT!
While we're at it, all the calls to free() must be replaced by std::free() !!
Finally, let me re-ask (since either you didn't reply to that or I
didn't understand the reply):
- how about moving MSVC's functions _aligned_... up in the priority list?
Benoit
2010/2/28 Hauke Heibel <hauke.heibel@xxxxxxxxxxxxxx>:
> Here is a new patch. I found the navigation in Memory.h a little
> complex so I tried to reorder the functions in order to achieve
> better/cleaner grouping.
>
> - Hauke
>
> On Sun, Feb 28, 2010 at 11:55 AM, Hauke Heibel
> <hauke.heibel@xxxxxxxxxxxxxx> wrote:
>> So, how about this one (a single handmade version):
>>
>> inline void* ei_new_handmade_aligned_realloc(void* ptr, size_t size,
>> size_t old_size)
>> {
>> if (ptr==0)
>> return ei_aligned_malloc(size);
>>
>> if (size==0)
>> {
>> ei_aligned_free(ptr);
>> return 0;
>> }
>>
>> void* newptr = ei_aligned_malloc(size,16);
>> if (newptr == 0)
>> {
>> /*errno = ENOMEM;*/ // according to the standard we should set
>> errno = ENOMEM
>> return 0;
>> }
>>
>> if (ptr != 0)
>> {
>> std::memcpy(newptr, ptr, std::min(size,old_size));
>> ei_aligned_free(ptr);
>> }
>>
>> return newptr;
>> }
>>
>> - Hauke
>>
>