[vsipl++] proposal: a typed alloc_align()
Mark Mitchell
mark at codesourcery.com
Thu Nov 3 18:54:19 UTC 2005
Nathan (Jasper) Myers wrote:
> On Thu, Nov 03, 2005 at 07:58:00AM -0800, Mark Mitchell wrote:
>
>>Jules Bergmann wrote:
>>
>>
>>> float* foo = alloc_align<float>(align, elem);
>>
>>Note that you could spell this like:
>>
>> new(vsip::impl::align(16)) float[elem]
>
>
> Be careful. Conventionally, storage obtained via op new is
> released via op delete. The compiler enforces that: if you said
> "new (vsip::impl::align (16)) vsip::Fft<>", for example, and the
> Fft<> constructor threw an exception, the implicit code generated
> by the compiler would call ::op delete itself.
>
> As a library, we can't replace ::op delete ourselves; that choice
> is reserved to the main program.
Yes, this may be a dumb idea, if any of our ways of allocating aligned
memory do not permit you to just call "free" on the returned pointer.
--
Mark Mitchell
CodeSourcery, LLC
mark at codesourcery.com
(916) 791-8304
More information about the vsipl++
mailing list