|
Posted by Neredbojias on 12/15/86 11:44
To further the education of mankind, Toby Inkster
<usenet200604@tobyinkster.co.uk> declaimed:
> Neredbojias wrote:
>
>> In computer-related languages, the first thing is usually the "0"
>> thing. Javascript, for example, numbers the initial item in the
>> images array (-and all arrays) "0".
>
> Ususally this is for historical and practical purposes.
>
> An array is often represented in memory as a single number that points
> to a location in memory. So the array "myvar[]" might refer to address
> "1000" in memory.
>
> If we want to retrieve the first item of the array, we can find it at
> memory address 1000. If we want to retrieve the second item in the
> array, it's at address 1001; the third item, at 1002; and so on.
>
> myvar[0] stored at 1000+0
> myvar[1] stored at 1000+1
> myvar[2] stored at 1000+2
> etc
>
> So retrieving an array item would be implemented internally by the
> programming language like this:
>
> function retrieve_item (array, index)
> {
> data_width = size_of(data_type_of(array));
> address = address_of(array) + (index * data_width);
> return retrieve_bytes(index, data_width);
> }
>
> Anyway, that's how arrays were implemented in many older programming
> languages, and still are in lower-level languages like C. Modern,
> higher-level languages don't tend to implement arrays like this, but
> retain 0-based indexes because that's what programmers are used to.
As I said - a sop to the geeks. But it's interesting that by starting
storage at some "round" number such as 1000, one leaves 999 memory
addresses before it. Further, elemental computer communication is done
in binary which may be "up-verted" to hexadecimal, neither of which holds
decimal 1000 to be a "round" number. In other words, the procedure is
just a sloppy programming technique.
In spite of all this, yes, "0" is not actually a value like any normal
ordinal number. However, you must have zero *something*. You can't have
zero *nothing*. I believe that's why the geek-boys call "null" a special
value. It doesn't say "I don't have any of these"; it says "there is no
'these' to begin with."
--
Neredbojias
Infinity can have limits.
Navigation:
[Reply to this message]
|