Re: Memory
On Sun, 10 Jan 1999 01:15:06 +0000, Tor Bernhard Gausen <tor.gausen at C2I.NET>
wrote:
>Robert Craig writes:
>
>> The Euphoria programmer can't tell whether an
>> atom is stored in one bit, one byte, 4 bytes, a
>> double, a 64-bit integer etc.
>
>Perhaps this is a silly question, but I just want to be certain...
>
>Does this mean that if I fill up a sequence with say 1.000 atoms
>containing only zeros and ones (each atom holding the value 0 OR
>the value 1), then the sequence will take up only about 125 bytes ?
>I mean, THAT would be (or perhaps it _IS_) great!
>
>The reason why I ask is that I somehow got the impression that
>each atom required a minimum of 4 bytes, which sounds like a
>terrible waste...
>
>What's right and what's wrong?
I think he means the _programmer_ doesn't need to know.
The person who writes Euphoria does - and can change that
in the future as long as no one depends on it being any
certain fixed size.
>
<snip>
>
>And while I'm at it, can anyone tell me specifically what the term
>'structure' means ? Example; is it related to code or data? Please
>convert your answear to my 2-digit IQ format
Both. A structure is a way to "package" variables so they can be
handled more conveniently.
Example in unEuphoria code:
structure customer
sequence name, addr, city, state, zip, phone
integer age
end structure
You could make assignments as follows:
customer.name = "John Smith"
customer.phone = "555-1212"
customer.age = 23
and write to disk as puts(fn, customer)
or assign the whole thing in one swell foop: thiscustomer = customer
which does the same as:
thiscustomer.name = customer.name
thiscustomer.addr = customer.addr
thiscustomer.city = customer.city...and so on.
There's also the term "structured code" which is another thing
altogether.
Irv
|
Not Categorized, Please Help
|
|