AKMA's Random Thoughts

February 20, 2003

Blog Refrigerator Door

A poem constituted by words extracted from this blog and rearranged, in the manner of refrigerator poetry magnets.

Posted by AKMA at February 20, 2003 08:16 AM | TrackBack
Comments

Very clever. Your idea?
Are you running with it?

Posted by: meg at February 20, 2003 01:41 PM

No, it's Mark Pilgrim's; just click on the image, and he'll lead you to the code (and dozens of other people's fridge magnet poetry). . . .

Posted by: AKMA at February 20, 2003 04:41 PM

The rest of our conversion follows a similar vein. Instead of going through line by line, let's just compare end results: when the transition is complete, the code that used to read:

Posted by: Susanna at January 12, 2004 08:57 PM

Earlier I mentioned that variables can live in two different places. We're going to examine these two places one at a time, and we're going to start on the more familiar ground, which is called the Stack. Understanding the stack helps us understand the way programs run, and also helps us understand scope a little better.

Posted by: Fulk at January 12, 2004 08:57 PM

But some variables are immortal. These variables are declared outside of blocks, outside of functions. Since they don't have a block to exist in they are called global variables (as opposed to local variables), because they exist in all blocks, everywhere, and they never go out of scope. Although powerful, these kinds of variables are generally frowned upon because they encourage bad program design.

Posted by: Jocatta at January 12, 2004 08:57 PM

Our next line looks familiar, except it starts with an asterisk. Again, we're using the star operator, and noting that this variable we're working with is a pointer. If we didn't, the computer would try to put the results of the right hand side of this statement (which evaluates to 6) into the pointer, overriding the value we need in the pointer, which is an address. This way, the computer knows to put the data not in the pointer, but into the place the pointer points to, which is in the Heap. So after this line, our int is living happily in the Heap, storing a value of 6, and our pointer tells us where that data is living.

Posted by: Ciriacus at January 13, 2004 09:57 AM

Each 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: Bennett at January 13, 2004 09:57 AM

Note the new asterisks whenever we reference favoriteNumber, except for that new line right before the return.

Posted by: Joos at January 13, 2004 09:57 AM