Using 'new'

F

Fred Zwarts

Aneel said:
How to allocate typeless memory to a pointer using 'new'.

In C++ there is normally no reason to allocate typeless memory,
except in allocators for classes for which the normal new is not desired,
where the placement new is used for the allocated memory.
So, I wonder why you need both the normal new and typeless memory.

Anyhow, you can get more or less typeless memory with
new char[Size]
and converting the resulting pointer to a void* pointer.
(Don't forget to deallocate the memory with delete[].)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Instead of [ new Array() ] 5
Hello I'm new to coding 1
New Programming Language GALAXION 2
Programming using memory runtime error 1
HTML coding links using notepad ++ 1
New to programming 3
I'm new 0
New here 0

Members online

Forum statistics

Threads
474,147
Messages
2,570,835
Members
47,382
Latest member
MichaleStr

Latest Threads

Top