Margaret and I had dinner with Susan and Trevor last night at Alice and Friends, where we had a vegetarian dinner that couldn’t be beat. After dinner, over ice cream, Susan gave Margaret some chocolate-for-drinking from Mexico, and Trevor gave us a copy of The Habitat EP by several. It’s a great disk, and knowing Trevor and Jim makes it an extra treat; lots of people should flood the several site with offers to buy it, right away.
Posted by AKMA at July 25, 2003 02:52 PM | TrackBackA variable leads a simple life, full of activity but quite short (measured in nanoseconds, usually). It all begins when the program finds a variable declaration, and a variable is born into the world of the executing program. There are two possible places where the variable might live, but we will venture into that a little later.
Posted by: Chroferus at January 13, 2004 12:38 PMFor this program, it was a bit of overkill. It's a lot of overkill, actually. There's usually no need to store integers in the Heap, unless you're making a whole lot of them. But even in this simpler form, it gives us a little bit more flexibility than we had before, in that we can create and destroy variables as we need, without having to worry about the Stack. It also demonstrates a new variable type, the pointer, which you will use extensively throughout your programming. And it is a pattern that is ubiquitous in Cocoa, so it is a pattern you will need to understand, even though Cocoa makes it much more transparent than it is here.
Posted by: Laura at January 13, 2004 12:38 PMSince the Heap has no definite rules as to where it will create space for you, there must be some way of figuring out where your new space is. And the answer is, simply enough, addressing. When you create new space in the heap to hold your data, you get back an address that tells you where your new space is, so your bits can move in. This address is called a Pointer, and it's really just a hexadecimal number that points to a location in the heap. Since it's really just a number, it can be stored quite nicely into a variable.
Posted by: Annanias at January 13, 2004 12:38 PM