void* pv = malloc(sizeof(int));
int* pi = new(pv) int;
Magmai Kai Holmlor
- Not For Rent
Placement new on MSVC6
Does MSVC6 handle placement new operations?
I couldn''t get it work, but I''ve never done it before, so I don''t know that I''ve got the syntax correct, nor if MSVC6 requires a special flavor if it does it at all.
I did this one before =P
int *pi;
pi= new int;
also if you want to put more meat on it ..
pi= new int[yoursizehere];
BTW typecast your void =)
Edited by - GoofProg on October 27, 2001 4:22:35 PM
int *pi;
pi= new int;
also if you want to put more meat on it ..
pi= new int[yoursizehere];
BTW typecast your void =)
Edited by - GoofProg on October 27, 2001 4:22:35 PM
unsigned char* pv = (unsigned char*)0x12345678;int* pi = new(pv) int;cout << &*pi << endl; // Outputs 0x12345678
Seems to work ... unless I am misunderstanding what placement new does.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement