Click here to Skip to main content
15,900,461 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionHow to convert static libs into DLL Pin
Wheatbread28-Feb-08 5:28
Wheatbread28-Feb-08 5:28 
GeneralRe: How to convert static libs into DLL Pin
Matthew Faithfull28-Feb-08 5:43
Matthew Faithfull28-Feb-08 5:43 
GeneralRe: How to convert static libs into DLL Pin
Wheatbread28-Feb-08 6:28
Wheatbread28-Feb-08 6:28 
QuestionHow does delete know it's size? [Solved] Pin
Hamed Musavi28-Feb-08 4:05
Hamed Musavi28-Feb-08 4:05 
GeneralRe: How does delete know it's size? Pin
CPallini28-Feb-08 4:19
mveCPallini28-Feb-08 4:19 
GeneralRe: How does delete know it's size? Pin
Hamed Musavi28-Feb-08 4:25
Hamed Musavi28-Feb-08 4:25 
GeneralRe: How does delete know it's size? Pin
Chris Losinger28-Feb-08 4:27
professionalChris Losinger28-Feb-08 4:27 
GeneralRe: How does delete know it's size? Pin
Hamed Musavi28-Feb-08 4:37
Hamed Musavi28-Feb-08 4:37 
I understand that. More details:

For instance I know int is 4 bytes. if I write:
int *pInt = new int;

I know pInt points to a memory area with 4 bytes length. If I force c++ to create 8 bytes and then cast the pointer and put it in another variable:
int *pBigInt = (int*)new BYTE[8];

and later on, I call delete:

delete[] pBigInt;


Will compiler uses size of the type of the pBigInt to delete pBigInt, or keeps track of all allocated size and deletes that. If this is the case, it might be possible to write something like this:

myStruct* pStruct = new myStruct(nSize);
where nSize is not equal to sizeof(myStruct);.

I hope I'm writing a human readable English Sigh | :sigh:

// "In the end it's a little boy expressing himself." Yanni
while (I_am_alive)
{
    cout<<"I love programming.";
}

GeneralRe: How does delete know it's size? Pin
CPallini28-Feb-08 4:41
mveCPallini28-Feb-08 4:41 
GeneralRe: How does delete know it's size? Pin
Hamed Musavi28-Feb-08 4:44
Hamed Musavi28-Feb-08 4:44 
AnswerRe: How does delete know it's size? Pin
Rajkumar R28-Feb-08 18:25
Rajkumar R28-Feb-08 18:25 
GeneralRe: How does delete know it's size? Pin
Hamed Musavi28-Feb-08 19:07
Hamed Musavi28-Feb-08 19:07 
QuestionRe: How does delete know it's size? Pin
Rajkumar R28-Feb-08 19:29
Rajkumar R28-Feb-08 19:29 
GeneralRe: How does delete know it's size? Pin
Hamed Musavi28-Feb-08 20:19
Hamed Musavi28-Feb-08 20:19 
AnswerRe: How does delete know it's size? [modified] Pin
Rajkumar R28-Feb-08 23:26
Rajkumar R28-Feb-08 23:26 
GeneralRe: How does delete know it's size? Pin
Hamed Musavi28-Feb-08 23:58
Hamed Musavi28-Feb-08 23:58 
GeneralRe: How does delete know it's size? Pin
Rajkumar R29-Feb-08 0:24
Rajkumar R29-Feb-08 0:24 
GeneralRe: How does delete know it's size? Pin
Hamed Musavi29-Feb-08 1:02
Hamed Musavi29-Feb-08 1:02 
GeneralRe: How does delete know it's size? Pin
Hamed Musavi28-Feb-08 4:49
Hamed Musavi28-Feb-08 4:49 
Questiondynamic array without new Pin
tobse28-Feb-08 3:02
tobse28-Feb-08 3:02 
QuestionRe: dynamic array without new Pin
David Crow28-Feb-08 3:11
David Crow28-Feb-08 3:11 
GeneralRe: dynamic array without new Pin
Cedric Moonen28-Feb-08 3:17
Cedric Moonen28-Feb-08 3:17 
GeneralRe: dynamic array without new Pin
tobse28-Feb-08 3:43
tobse28-Feb-08 3:43 
GeneralRe: dynamic array without new Pin
Cedric Moonen28-Feb-08 3:49
Cedric Moonen28-Feb-08 3:49 
QuestionRe: dynamic array without new Pin
CPallini28-Feb-08 3:21
mveCPallini28-Feb-08 3:21 

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.