Chance. Chair on the slant
magnifying a penchant
for fractious, gambling behavior
before it leaves, forever.
[Warped floor: hence, a person of no wealth. He's had to put a rug down to keep his desk chair from rolling away as he typed. This poem is especially prized because he seems to enjoy it.]
Posted by Brian Stefans at August 11, 2003 04:38 PM | TrackBackThis is another function provided for dealing with the heap. After you've created some space in the Heap, it's yours until you let go of it. When your program is done using it, you have to explicitly tell the computer that you don't need it anymore or the computer will save it for your future use (or until your program quits, when it knows you won't be needing the memory anymore). The call to simply tells the computer that you had this space, but you're done and the memory can be freed for use by something else later on.
Posted by: Brian at January 18, 2004 11:08 PMInside each stack frame is a slew of useful information. It tells the computer what code is currently executing, where to go next, where to go in the case a return statement is found, and a whole lot of other things that are incredible useful to the computer, but not very useful to you most of the time. One of the things that is useful to you is the part of the frame that keeps track of all the variables you're using. So the first place for a variable to live is on the Stack. This is a very nice place to live, in that all the creation and destruction of space is handled for you as Stack Frames are created and destroyed. You seldom have to worry about making space for the variables on the stack. The only problem is that the variables here only live as long as the stack frame does, which is to say the length of the function those variables are declared in. This is often a fine situation, but when you need to store information for longer than a single function, you are instantly out of luck.
Posted by: Matilda at January 18, 2004 11:09 PMThis back and forth is an important concept to understand in C programming, especially on the Mac's RISC architecture. Almost every variable you work with can be represented in 32 bits of memory: thirty-two 1s and 0s define the data that a simple variable can hold. There are exceptions, like on the new 64-bit G5s and in the 128-bit world of AltiVec
Posted by: Pompey at January 18, 2004 11:10 PMThese secret identities serve a variety of purposes, and they help us to understand how variables work. In this lesson, we'll be writing a little less code than we've done in previous articles, but we'll be taking a detailed look at how variables live and work.
Posted by: Ralph at January 18, 2004 11:10 PMThis code should compile and run just fine, and you should see no changes in how the program works. So why did we do all of that?
Posted by: Wombell at January 18, 2004 11:10 PM