Click here to Skip to main content
15,881,709 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionRe: very urgent help needed in openmp Pin
Maximilien16-Apr-10 7:45
Maximilien16-Apr-10 7:45 
AnswerRe: very urgent help needed in openmp Pin
aruneshjoshi16-Apr-10 7:53
aruneshjoshi16-Apr-10 7:53 
AnswerRe: very urgent help needed in openmp Pin
loyal ginger16-Apr-10 7:54
loyal ginger16-Apr-10 7:54 
GeneralRe: very urgent help needed in openmp Pin
aruneshjoshi16-Apr-10 8:06
aruneshjoshi16-Apr-10 8:06 
QuestionRe: very urgent help needed in openmp Pin
David Crow16-Apr-10 8:29
David Crow16-Apr-10 8:29 
AnswerRe: very urgent help needed in openmp Pin
aruneshjoshi16-Apr-10 8:44
aruneshjoshi16-Apr-10 8:44 
GeneralRe: very urgent help needed in openmp Pin
rchrd16-Apr-10 9:26
rchrd16-Apr-10 9:26 
QuestionAllocation/Deallocation from Memory Pool [Solved] Pin
Skippums16-Apr-10 4:17
Skippums16-Apr-10 4:17 
I am wondering if the type passed to delete[] needs to be the same as the type allocated by new? I am attempting to do the following:
void**  memPoolPtrs = new void* [4 * (1 + 12)];
double* memPoolData = new double[4 * 12 * 30];
double*** myData = reinterpret_cast<double***>(memPoolPtrs);
memPoolPtrs += 4;
for (size_t idx0 = 0; idx0 < 4; ++idx0) {
    myData[idx0] = reinterpret_cast<double**>(memPoolPtrs);
    memPoolPtrs += 12;
    for (size_t idx1 = 0; idx1 < 12; ++idx1) {
        myData[idx0][idx1] = memPoolData;
        memPoolData += 30;
    }
}

// Do some stuff with myData

delete[] **myData; // Delete ALL dynamically allocated doubles
delete[]   myData; // Delete ALL dynamically allocated pointers
Is there any risk in the above approach (other than allocating things of improper size)? I can't think of a reason why such a thing wouldn't work, but I am curious if the two delete statements will work as I anticipate. Thanks,
Sounds like somebody's got a case of the Mondays

-Jeff
modified on Friday, April 16, 2010 12:41 PM

AnswerRe: Allocation/Deallocation from Memory Pool Pin
«_Superman_»16-Apr-10 6:41
professional«_Superman_»16-Apr-10 6:41 
AnswerRe: Allocation/Deallocation from Memory Pool [Solved] Pin
cmk16-Apr-10 9:06
cmk16-Apr-10 9:06 
AnswerRe: Allocation/Deallocation from Memory Pool [Solved] Pin
Gwenio16-Apr-10 9:21
Gwenio16-Apr-10 9:21 
QuestionCan we Insert table into SDI Application ? Pin
Khathar16-Apr-10 1:54
Khathar16-Apr-10 1:54 
AnswerRe: Can we Insert table into SDI Application ? Pin
Maximilien16-Apr-10 2:50
Maximilien16-Apr-10 2:50 
AnswerRe: Can we Insert table into SDI Application ? Pin
«_Superman_»16-Apr-10 6:47
professional«_Superman_»16-Apr-10 6:47 
QuestionCComboBox the max text length ?? Pin
Arrin16-Apr-10 0:28
Arrin16-Apr-10 0:28 
AnswerRe: CComboBox the max text length ?? SOLVED Pin
Arrin16-Apr-10 0:43
Arrin16-Apr-10 0:43 
QuestionWorker Thread GUI Pin
MsmVc15-Apr-10 22:21
MsmVc15-Apr-10 22:21 
AnswerRe: Worker Thread GUI Pin
Cedric Moonen15-Apr-10 22:33
Cedric Moonen15-Apr-10 22:33 
AnswerRe: Worker Thread GUI Pin
Eugen Podsypalnikov15-Apr-10 22:44
Eugen Podsypalnikov15-Apr-10 22:44 
GeneralRe: Worker Thread GUI Pin
MsmVc15-Apr-10 23:07
MsmVc15-Apr-10 23:07 
GeneralRe: Worker Thread GUI Pin
Cedric Moonen15-Apr-10 23:17
Cedric Moonen15-Apr-10 23:17 
GeneralRe: Worker Thread GUI [modified] Pin
Eugen Podsypalnikov15-Apr-10 23:38
Eugen Podsypalnikov15-Apr-10 23:38 
GeneralRe: Worker Thread GUI Pin
Eugen Podsypalnikov16-Apr-10 0:21
Eugen Podsypalnikov16-Apr-10 0:21 
GeneralRe: Worker Thread GUI Pin
Cedric Moonen15-Apr-10 23:13
Cedric Moonen15-Apr-10 23:13 
GeneralRe: Worker Thread GUI Pin
Eugen Podsypalnikov16-Apr-10 0:20
Eugen Podsypalnikov16-Apr-10 0:20 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.