Actions

icon Post
text/html Subscribe
text/html Unsubscribe

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [vsipl++] proposal: a typed alloc_align()


  • To: "Nathan (Jasper) Myers" <ncm@xxxxxxxxxxxxxxxx>
  • Subject: Re: [vsipl++] proposal: a typed alloc_align()
  • From: Mark Mitchell <mark@xxxxxxxxxxxxxxxx>
  • Date: Thu, 03 Nov 2005 10:54:19 -0800

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@xxxxxxxxxxxxxxxx
(916) 791-8304