Click here to Skip to main content
15,916,702 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Generalcaps lock Pin
Archer28221-Feb-04 20:03
Archer28221-Feb-04 20:03 
GeneralRe: caps lock Pin
Ravi Bhavnani22-Feb-04 10:02
professionalRavi Bhavnani22-Feb-04 10:02 
GeneralMemory Management in C++ Pin
Iceberg7621-Feb-04 18:44
Iceberg7621-Feb-04 18:44 
GeneralRe: Memory Management in C++ Pin
Arcrest21-Feb-04 21:00
Arcrest21-Feb-04 21:00 
GeneralRe: Memory Management in C++ Pin
Keith Vitali22-Feb-04 0:09
Keith Vitali22-Feb-04 0:09 
GeneralRe: Memory Management in C++ Pin
Gary R. Wheeler22-Feb-04 4:43
Gary R. Wheeler22-Feb-04 4:43 
GeneralRe: Memory Management in C++ Pin
Iceberg7622-Feb-04 8:19
Iceberg7622-Feb-04 8:19 
GeneralRe: Memory Management in C++ Pin
Gary R. Wheeler22-Feb-04 15:38
Gary R. Wheeler22-Feb-04 15:38 
Iceberg76 wrote:
Thank You

You're welcome.

Iceberg76 wrote:
Do heap objects need to be called within functions, or can they be global as well?

Pointers to heap objects can be global, or can be passed from routine to routine as needed. The objects themselves reside on the heap, which in a sense is a global data structure.

Iceberg76 wrote:
When should I use a heap object rather than using a global or stackobject?

Using the heap is a good idea when you don't know how many objects you'll need. One time, you may only allocate one object. The next time, maybe you'll need ten. The heap lets you adapt to that kind of situation.

Global objects have their good and bad points. They are good, in that a global object is easy to access from a lot of points in your software. Unfortunately, that's also their weak point. Since they can be accessed from everywhere, your software can get pretty tangled up. You'll find out that you can't change this feature of the object, because that part of the application depends on it. It can make maintenance and debugging a nightmare.

Stack objects are useful when you know you only need the object for the duration of a given routine.


Software Zen: delete this;
Generalhelp with classes Pin
GdsFisher21-Feb-04 18:00
GdsFisher21-Feb-04 18:00 
GeneralRe: help with classes Pin
wb21-Feb-04 18:26
wb21-Feb-04 18:26 
GeneralRe: help with classes Pin
Iceberg7621-Feb-04 18:29
Iceberg7621-Feb-04 18:29 
GeneralRe: help with classes Pin
GdsFisher22-Feb-04 6:19
GdsFisher22-Feb-04 6:19 
GeneralStrings in C++ Pin
Iceberg7621-Feb-04 16:14
Iceberg7621-Feb-04 16:14 
GeneralRe: Strings in C++ Pin
Tim Smith21-Feb-04 17:11
Tim Smith21-Feb-04 17:11 
GeneralRe: Strings in C++ Pin
Iceberg7621-Feb-04 19:28
Iceberg7621-Feb-04 19:28 
GeneralRe: Strings in C++ Pin
markkuk21-Feb-04 23:58
markkuk21-Feb-04 23:58 
GeneralRe: Strings in C++ Pin
Tim Smith22-Feb-04 4:13
Tim Smith22-Feb-04 4:13 
GeneralRe: Strings in C++ Pin
Michael Dunn22-Feb-04 5:48
sitebuilderMichael Dunn22-Feb-04 5:48 
GeneralRe: Strings in C++ Pin
Tim Smith22-Feb-04 6:34
Tim Smith22-Feb-04 6:34 
GeneralRe: Strings in C++ Pin
Michael Dunn22-Feb-04 6:40
sitebuilderMichael Dunn22-Feb-04 6:40 
GeneralRe: Strings in C++ Pin
Iceberg7622-Feb-04 9:49
Iceberg7622-Feb-04 9:49 
GeneralRe: Strings in C++ Pin
Tim Smith22-Feb-04 11:16
Tim Smith22-Feb-04 11:16 
GeneralRe: Strings in C++ Pin
Tim Smith22-Feb-04 4:15
Tim Smith22-Feb-04 4:15 
GeneralRe: Strings in C++ Pin
David Crow23-Feb-04 3:14
David Crow23-Feb-04 3:14 
Questionhow to connect to access database in vc++6.0? Pin
Anonymous21-Feb-04 16:09
Anonymous21-Feb-04 16:09 

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.