Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

 
 
Thread Tools Display Modes
Prev Previous Post in Thread   Next Post in Thread Next
Old Oct 23rd, 2006, 5:17 PM   #1
Eric the Red
Hobbyist Programmer
 
Eric the Red's Avatar
 
Join Date: Feb 2006
Posts: 214
Rep Power: 0 Eric the Red is an unknown quantity at this point
Heap vs. Stack memory

A while back, we had this discussion already. Found here

However, recently after reading through "Sam's c++ in 24 hours" by Jesse Liberty. I came up across this line: in a section on "arrays of pointers":
Quote:
The arrays discussed so far store all their members on the stack. Usually stack memory is severely limited, whereas heap memory is far larger. It is possible to declare each object on the heap and then to store only a pointer to the object in the array. This dramatically reduces the amount of stack memory used.
Later on in the paragraph right before the example "storing an array on the heap" it states:
Quote:

As an indication of the greater memory that this makes possible, the array is expanded from 5 to 500...
(Obviously an exaggeration "5 to 500")

I bolded the points that were a contrast to what you guys were saying.
Now saying that "Usually stack memory is severely limited, isn't BS is it?" For, many people have not mentioned that.

I'm completely confused now, you guys are saying one thing... the books telling me another thing. What's really going on and why has this author gotten away with being able to write (on the back of the book cover) "Over 250,000 readers have learned c++ from author Jesse Liberty".


/-------------------------------------------------

As Grumpy stated "is only",
Quote:
The distinction between the two forms, from a pure C++ perspective, is only to do with how lifetime of objects are managed.
Again Grumpy,

Quote:
From a C++ language perspective, the only purpose of new and delete are to manage dynamic memory. Nothing more, nothing less.
Dawei

Quote:
It has nothing, really, to do with memory architecture and what areas of memory are more "readily" available than others. The "stack" is, in reality, a lifo stack. Items are stored and retrieved in the expected way for lifo stacks.
Now, how is it that my book tends to go in a completely different direction of what you guys are saying. Now, I know there may be a good explanation for this. Please, someone clear this up.
__________________
Death smiles at us all. All a man can do is smile back.
Eric the Red is offline   Reply With Quote
 

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Combining languages titaniumdecoy Other Programming Languages 12 Jul 13th, 2006 2:03 PM
Assembly tutorial, part one. Mad_guy Software Design and Algorithms 21 Apr 15th, 2006 7:02 PM
A noob to Assembly CodeJunkie Assembly 12 Jan 25th, 2006 2:06 PM
STACK- acessing argc and argv outside main() mguarin C 9 Oct 28th, 2005 8:38 PM
Pointers in C (Part I) Stack Overflow C 4 Apr 28th, 2005 7:03 PM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 1:03 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC