Click here to Skip to main content
15,898,987 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralProblem while running exe.. Pin
Ashish Chauhan12-Feb-08 1:45
Ashish Chauhan12-Feb-08 1:45 
GeneralRe: Problem while running exe.. Pin
Cedric Moonen12-Feb-08 1:54
Cedric Moonen12-Feb-08 1:54 
GeneralRe: Problem while running exe.. Pin
Ashish Chauhan12-Feb-08 1:59
Ashish Chauhan12-Feb-08 1:59 
GeneralRe: Problem while running exe.. Pin
Rajkumar R12-Feb-08 4:03
Rajkumar R12-Feb-08 4:03 
QuestionC++ Questions [modified] Pin
Andy Rama12-Feb-08 0:35
Andy Rama12-Feb-08 0:35 
GeneralRe: C++ Questions Pin
jhwurmbach12-Feb-08 1:30
jhwurmbach12-Feb-08 1:30 
GeneralRe: C++ Questions Pin
Andy Rama12-Feb-08 22:36
Andy Rama12-Feb-08 22:36 
GeneralRe: C++ Questions Pin
Matthew Faithfull12-Feb-08 2:40
Matthew Faithfull12-Feb-08 2:40 
Hi, I have some answers perhaps.

1. You would override the global new and delete operatos if yuo wanted to use your own heap memory manager rather than the one in the C Runtime for all memory management in your process. C# does this to implement 'managed memory' for you.

You would override the new and delete operators within a class if you wanted to implement some special allocation scheme for instances of that class or to selectively make it use your own memory manager.

2. Log every allocation with a unique number and every deallocation with a matching number. One cancels the other, anything left at the end is a leak. Sounds simple but not easy in practice.

3. MACROs dont declare variables they do the equivalent of #define wordy SomethingElse. Unless SomethingElse is also validly decalred you can't use wordy as a variable.

4. What C++ can do that C can't is 'data hiding'. Declaring private or protected members in a class anf=d then giving access to them only through, for example, Get and Set functions. This allows you to error check and trace all accesses and potentially to change the underlying name or even type of the member without breaking any other code as long as the accessors still work and have the same signatures everything is Cool | :cool:

5. Yes, just remember to use the matching version of free.

6. global variables are global, enough said. Class statics are global but their names are class specific, so CAButton::s_MyStaticMember is refered to as such and does not clash with CAScroller::s_MyStaticMember which is a compleely different variable. C++ initializes statics using some Compiler/Linker trickery and bits bootstrap code in the CRuntime which can be a bit messy.

Nothing is exactly what it seems but everything with seems can be unpicked.

QuestionRe: C++ Questions Pin
Andy Rama12-Feb-08 21:54
Andy Rama12-Feb-08 21:54 
GeneralRe: C++ Questions Pin
Matthew Faithfull12-Feb-08 22:26
Matthew Faithfull12-Feb-08 22:26 
GeneralRe: C++ Questions Pin
Andy Rama12-Feb-08 22:32
Andy Rama12-Feb-08 22:32 
Generalset left and right Pin
gentleguy11-Feb-08 23:26
gentleguy11-Feb-08 23:26 
QuestionRe: set left and right Pin
CPallini11-Feb-08 23:37
mveCPallini11-Feb-08 23:37 
GeneralRe: set left and right Pin
gentleguy12-Feb-08 0:15
gentleguy12-Feb-08 0:15 
QuestionRe: set left and right Pin
CPallini12-Feb-08 0:26
mveCPallini12-Feb-08 0:26 
GeneralRe: set left and right Pin
gentleguy12-Feb-08 1:04
gentleguy12-Feb-08 1:04 
GeneralRe: set left and right Pin
CPallini12-Feb-08 2:09
mveCPallini12-Feb-08 2:09 
GeneralRe: set left and right Pin
gentleguy12-Feb-08 19:45
gentleguy12-Feb-08 19:45 
QuestionRe: set left and right Pin
CPallini12-Feb-08 21:30
mveCPallini12-Feb-08 21:30 
QuestionHow to automate VC++ builds Pin
cagespear11-Feb-08 23:13
cagespear11-Feb-08 23:13 
AnswerRe: How to automate VC++ builds Pin
Haroon Sarwar12-Feb-08 1:10
Haroon Sarwar12-Feb-08 1:10 
GeneralRe: How to automate VC++ builds Pin
cagespear12-Feb-08 17:25
cagespear12-Feb-08 17:25 
AnswerRe: How to automate VC++ builds Pin
jhwurmbach12-Feb-08 1:35
jhwurmbach12-Feb-08 1:35 
QuestionRe: How to automate VC++ builds Pin
Matthew Faithfull12-Feb-08 4:15
Matthew Faithfull12-Feb-08 4:15 
GeneralRe: How to automate VC++ builds Pin
jhwurmbach12-Feb-08 4:18
jhwurmbach12-Feb-08 4:18 

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.