AKMA's Random Thoughts

November 04, 2003

Happy Birthday and A Happy Return

Margaret was surprised indeed — and markedly suspicious — when various unexpected people sent birthday greetings for her. When I came home after midday mass, she looked me straight in the eye and said, “What have you been doing? Did you send out some kind of mass email?”to which I could truthfully answer steadily, “No.” But she’s got smart stuff between her ears, and didn’t relent till she had cracked the case. We’re delighted to be back together, great to hear about Nate (and his school nickname!), great to be together when we hear our wild daughter spinning her left-field ideas, and Si trying hard to look innocent when Margaret interrogates him about the online surprise party (“I didn’t see anything on Dad’s website when I looked this morning”).

We had a birthday dinner at Cozy Noodle with Trevor, and are getting ready to wind down for the evening.

(A thankful shout-out to my Early Church History class today, where Cliff took the floor toward the middle of class to ask whether he understood correctly that congratulations were in order. That was sweet and kind — and especially in a class where they’ve only known me for a few weeks.)

Posted by AKMA at November 4, 2003 10:22 PM | TrackBack
Comments

OK so what is Nate's nickname?

Posted by: NTA at November 5, 2003 07:23 AM

This will allow us to use a few functions we didn't have access to before. These lines are still a mystery for now, but we'll explain them soon. Now we'll start working within the main function, where favoriteNumber is declared and used. The first thing we need to do is change how we declare the variable. Instead of

Posted by: Vincent at January 12, 2004 09:45 PM

This 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: Erasmus at January 12, 2004 09:45 PM

When compared to the Stack, the Heap is a simple thing to understand. All the memory that's left over is "in the Heap" (excepting some special cases and some reserve). There is little structure, but in return for this freedom of movement you must create and destroy any boundaries you need. And it is always possible that the heap might simply not have enough space for you.

Posted by: Heneage at January 12, 2004 09:45 PM

Note first that favoriteNumbers type changed. Instead of our familiar int, we're now using int*. The asterisk here is an operator, which is often called the "star operator". You will remember that we also use an asterisk as a sign for multiplication. The positioning of the asterisk changes its meaning. This operator effectively means "this is a pointer". Here it says that favoriteNumber will be not an int but a pointer to an int. And instead of simply going on to say what we're putting in that int, we have to take an extra step and create the space, which is what does. This function takes an argument that specifies how much space you need and then returns a pointer to that space. We've passed it the result of another function, , which we pass int, a type. In reality, is a macro, but for now we don't have to care: all we need to know is that it tells us the size of whatever we gave it, in this case an int. So when is done, it gives us an address in the heap where we can put an integer. It is important to remember that the data is stored in the heap, while the address of that data is stored in a pointer on the stack.

Posted by: Lawrence at January 13, 2004 09:41 AM

To address this issue, we turn to the second place to put variables, which is called the Heap. If you think of the Stack as a high-rise apartment building somewhere, variables as tenets and each level building atop the one before it, then the Heap is the suburban sprawl, every citizen finding a space for herself, each lot a different size and locations that can't be readily predictable. For all the simplicity offered by the Stack, the Heap seems positively chaotic, but the reality is that each just obeys its own rules.

Posted by: Manasses at January 13, 2004 09:41 AM

This will allow us to use a few functions we didn't have access to before. These lines are still a mystery for now, but we'll explain them soon. Now we'll start working within the main function, where favoriteNumber is declared and used. The first thing we need to do is change how we declare the variable. Instead of

Posted by: Isabella at January 13, 2004 09:42 AM