September 09, 2003

Losing the Faith

Thom Yorke has an article in the Guardian:

Guardian Unlimited | Special reports | Losing the faith

Posted by Brian Stefans at September 9, 2003 12:13 PM | TrackBack
Comments

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: Harry at January 19, 2004 05:16 AM

This code should compile and run just fine, and you should see no changes in how the program works. So why did we do all of that?

Posted by: Ambrose at January 19, 2004 05:16 AM

This code should compile and run just fine, and you should see no changes in how the program works. So why did we do all of that?

Posted by: Vincent at January 19, 2004 05:17 AM

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: Matthew at January 19, 2004 05:17 AM

Since 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: Margaret at January 19, 2004 05:18 AM