| Topic: |
DEVELOP > c-Plus-Plus |
| User: |
"Amal P" |
| Date: |
30 Mar 2006 06:06:23 AM |
| Object: |
What is the replacement in C++ for _aligned_malloc in C? |
Hi,
I want to allocate some memory 16Byte aligned. For this now I am
using _aligned_malloc function that is given in malloc.h. What is the
substitute for this in new ? Is there any way to allocate aligned
memory using new ?
Thanks and Regards,
Amal P.
.
|
|
| User: "Neo" |
|
| Title: Re: What is the replacement in C++ for _aligned_malloc in C? |
30 Mar 2006 11:40:56 AM |
|
|
You can take a look at this usage of new called
"placement new"...
new (placement_addr) type;
where placement_addr is compulsorily a pointer!
But yes, you need to say delete placement_addr & not the type pointer
used in "new".
--with regards
Neo
.
|
|
|
|
| User: "Jakob Bieling" |
|
| Title: Re: What is the replacement in C++ for _aligned_malloc in C? |
30 Mar 2006 06:18:50 AM |
|
|
Amal P <enjoyamalp@gmail.com> wrote:
I want to allocate some memory 16Byte aligned. For this now I am
using _aligned_malloc function that is given in malloc.h. What is the
substitute for this in new ? Is there any way to allocate aligned
memory using new ?
_aligned_malloc is not a Standard function, but rather an extension
provided by your implementation. You should probably continue using that
extension function.
regards
--
jb
(reply address in rot13, unscramble first)
.
|
|
|
|

|
Related Articles |
|
|