I read the story about John Gilmore (from boingboing) being kept off his flight home from the UK because he was wearing a “Terrorist Suspect” button, and my eyes glinted. “Hey, I’m about to go on an international flight! Maybe I could get one of those buttons. . . .”
Margaret furrowed her brow and glared at me.
“Or maybe not.”
[Later: the site to which John Gilmore links has removed the offending button from its catalogue; evidently the publicity hosed their bandwidth. Anyone have it cached somewhere?]
Posted by AKMA at July 21, 2003 10:45 AM | TrackBackAll hail the Wayback Machine:
http://web.archive.org/web/20020725053538/eminism.org/buttons/img-btn/suspected.gif
No, all hail ARJ for thinking of the Wayback!
Posted by: AKMA at July 21, 2003 09:27 PMAnd mirrored indefinitely here:
http://disobey.com/d/2003/
Thanks, AKMA.
We can see an example of this in our code we've written so far. In each function's block, we declare variables that hold our data. When each function ends, the variables within are disposed of, and the space they were using is given back to the computer to use. The variables live in the blocks of conditionals and loops we write, but they don't cascade into functions we call, because those aren't sub-blocks, but different sections of code entirely. Every variable we've written has a well-defined lifetime of one function.
Posted by: Zachary at January 13, 2004 12:11 AMLet's see an example by converting our favoriteNumber variable from a stack variable to a heap variable. The first thing we'll do is find the project we've been working on and open it up in Project Builder. In the file, we'll start right at the top and work our way down. Under the line:
Posted by: Rosanna at January 13, 2004 12:11 AMThis 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: Susanna at January 13, 2004 12:11 AMEach Stack Frame represents a function. The bottom frame is always the main function, and the frames above it are the other functions that main calls. At any given time, the stack can show you the path your code has taken to get to where it is. The top frame represents the function the code is currently executing, and the frame below it is the function that called the current function, and the frame below that represents the function that called the function that called the current function, and so on all the way down to main, which is the starting point of any C program.
Posted by: Griffin at January 13, 2004 12:27 PMThat gives us a pretty good starting point to understand a lot more about variables, and that's what we'll be examining next lesson. Those new variable types I promised last lesson will finally make an appearance, and we'll examine a few concepts that we'll use to organize our data into more meaningful structures, a sort of precursor to the objects that Cocoa works with. And we'll delve a little bit more into the fun things we can do by looking at those ever-present bits in a few new ways.
Posted by: Marmaduke at January 13, 2004 12:28 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: Ellen at January 13, 2004 12:28 PM