AKMA's Random Thoughts

May 29, 2003

Well, What About It?

How about Steve Himmer for President on the Green Party Ticket? I hear it pays better than TA-ing, Steve, and you obviously aren’t underqualified.

Posted by AKMA at May 29, 2003 08:27 AM | TrackBack
Comments

Maybe when I'm old enough to run... :)

Honestly, I think what the Greens need more than candidates right now is a buzz, some momentum to carry them first over the hurdle of negative assumption--'you cost us the last election'--and into political legitimacy. I'm not entirely sure the White House is even the place to start: as much I admire and agree with Ralph Nader, I still question how much he could have realistically accomplished as president without significant Green representation in Congress and in State Legislatures. As we've seen with W. and before, single-party domination of all three branches is a mighty powerful force, far more powerful than an outsider executive and insider legislative. Which isn't to suggest one shouldn't ever reach for the unrealistic, only that perhaps long-range plans need to be attended to as well as short.

But that's enough political speculation for one morning, no?

Posted by: steve at May 29, 2003 08:39 AM

Okay, Steve, so run for something more local. :)

Posted by: Dorothea Salo at May 29, 2003 09:26 AM

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: Catherine at January 12, 2004 06:29 PM

This variable is then used in various lines of code, holding values given it by variable assignments along the way. In the course of its life, a variable can hold any number of variables and be used in any number of different ways. This flexibility is built on the precept we just learned: a variable is really just a block of bits, and those bits can hold whatever data the program needs to remember. They can hold enough data to remember an integer from as low as -2,147,483,647 up to 2,147,483,647 (one less than plus or minus 2^31). They can remember one character of writing. They can keep a decimal number with a huge amount of precision and a giant range. They can hold a time accurate to the second in a range of centuries. A few bits is not to be scoffed at.

Posted by: Edward at January 12, 2004 06:29 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: Barbara at January 12, 2004 06:29 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: Lionel at January 13, 2004 07:01 AM

Inside 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: Roman at January 13, 2004 07:01 AM

When a variable is finished with it's work, it does not go into retirement, and it is never mentioned again. Variables simply cease to exist, and the thirty-two bits of data that they held is released, so that some other variable may later use them.

Posted by: Barnabas at January 13, 2004 07:02 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: Prudence at January 13, 2004 11:44 AM

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: Harman at January 13, 2004 11:44 AM

Being able to understand that basic idea opens up a vast amount of power that can be used and abused, and we're going to look at a few of the better ways to deal with it in this article.

Posted by: Kenelm at January 13, 2004 11:44 AM