Click here to Skip to main content
15,919,132 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Static object in mfc, only one instance for all instance of my class Pin
Chris Losinger17-Sep-01 4:51
professionalChris Losinger17-Sep-01 4:51 
GeneralRe: Static object in mfc, only one instance for all instance of my class Pin
Remi Morin17-Sep-01 4:58
Remi Morin17-Sep-01 4:58 
GeneralTell me the difference :) Pin
17-Sep-01 4:40
suss17-Sep-01 4:40 
GeneralRe: Tell me the difference :) Pin
Remi Morin17-Sep-01 5:09
Remi Morin17-Sep-01 5:09 
GeneralRe: Tell me the difference :) Pin
Remi Morin17-Sep-01 5:29
Remi Morin17-Sep-01 5:29 
GeneralRe: Tell me the difference :) Pin
Remi Morin17-Sep-01 6:02
Remi Morin17-Sep-01 6:02 
GeneralCorrection: Tell me the difference :) Pin
17-Sep-01 22:28
suss17-Sep-01 22:28 
GeneralRe: Tell me the difference :) Pin
Alvaro Mendez18-Sep-01 10:42
Alvaro Mendez18-Sep-01 10:42 
Differences:

char something[64];
An array of 64 elements, each of sizeof(char) bytes, is allocated on the stack and given the name "something". This is extremely fast, as it only requires the stack pointer to be moved down by 64 bytes. When the function returns, the stack is automatically cleaned up, which includes this array. The drawback is that number of elements in the array (64 in this case) must be predetermined at compile time. In fact, the compiler checks that this value is constant.

char* something = new char[64];
delete [] something;

An array of 64 elements, each of sizeof(char) bytes, is allocated on the heap and returned as a pointer which is given the name "something". This is typically a slower operation since the heap manager spends more time managing its available space for all dynamic allocations. It also requires that the programmer explicitly tell the heap when the memory is no longer needed (by calling delete). The benefit is that the program can set the size of the array (64 in this case) at run time. In other words, the value can just as well be an integer variable.

Regards,
Alvaro
GeneralAbsolute bloody ADO hell Pin
Christian Graus17-Sep-01 3:55
protectorChristian Graus17-Sep-01 3:55 
GeneralRe: Absolute bloody ADO hell Pin
Michael P Butler17-Sep-01 4:01
Michael P Butler17-Sep-01 4:01 
GeneralRe: Absolute bloody ADO hell Pin
Christian Graus17-Sep-01 4:06
protectorChristian Graus17-Sep-01 4:06 
GeneralRe: Absolute bloody ADO hell Pin
Michael P Butler17-Sep-01 4:27
Michael P Butler17-Sep-01 4:27 
GeneralRe: Absolute bloody ADO hell Pin
Christian Graus17-Sep-01 4:27
protectorChristian Graus17-Sep-01 4:27 
GeneralRe: Absolute bloody ADO hell Pin
Michael P Butler17-Sep-01 4:35
Michael P Butler17-Sep-01 4:35 
GeneralRe: Absolute bloody ADO hell Pin
Jeremy Pullicino17-Sep-01 5:29
Jeremy Pullicino17-Sep-01 5:29 
GeneralRe: Absolute bloody ADO hell Pin
Christian Graus17-Sep-01 13:00
protectorChristian Graus17-Sep-01 13:00 
GeneralAbsolute bloody ATL hell Pin
Christian Graus17-Sep-01 2:12
protectorChristian Graus17-Sep-01 2:12 
GeneralRe: Absolute bloody ATL hell Pin
Michael P Butler17-Sep-01 2:35
Michael P Butler17-Sep-01 2:35 
GeneralRe: Absolute bloody ATL hell Pin
Christian Graus17-Sep-01 2:51
protectorChristian Graus17-Sep-01 2:51 
GeneralRe: Absolute bloody ATL hell Pin
Michael P Butler17-Sep-01 3:02
Michael P Butler17-Sep-01 3:02 
GeneralRe: Absolute bloody ATL hell Pin
Christian Graus17-Sep-01 3:10
protectorChristian Graus17-Sep-01 3:10 
GeneralRe: Absolute bloody ATL hell Pin
Michael P Butler17-Sep-01 3:15
Michael P Butler17-Sep-01 3:15 
GeneralRe: Absolute bloody ATL hell Pin
Christian Graus17-Sep-01 3:30
protectorChristian Graus17-Sep-01 3:30 
GeneralHandling Button's Events Pin
MAAK17-Sep-01 1:26
MAAK17-Sep-01 1:26 
GeneralRe: Handling Button's Events Pin
Michael P Butler17-Sep-01 2:01
Michael P Butler17-Sep-01 2:01 

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.