|
Just a few nits (not ninnies) to pick
Posted by Gregory Ross at 03/19/2001 1:28 PM EST
Engineer on team #330, Beach Bots, from Hope Chapel Academy and NASA/JPL.
In Reply to: YES
Posted by Stephen on 03/18/2001 8:58 PM EST:
I hate it when my kids get nit-picky, but I guess they come by it honestly ;-)
Steven,
Actually, constants don't need to be defined in every program (unless, of course, they are used in multiple programs) since they take up no variable space.
...and Gui,
It's true that the variable data stays in memory between programs, but one program has no idea of variables defined in another program, or how much variable space is used by other programs unless you tell it (by defining all variables in all programs.)
Also, defining variables takes up no PROGRAM space (EEPROM) only VARIABLE space (RAM). (I realize that may have been what you meant when you wrote "program space" -- Just wanted to be sure all those nasty little nits were gone :-)
Of course, since variable space is so much more limited (26 bytes) than program space(64Kytes per program), then conserving variable space may be of much greater concern.
Maybe an example would be helpful: Consider the case where you have one program that fills 10 byte variables, and another program that sums those ten bytes and stores the result into a word variable.
If the first program only defined the 10 bytes, then since the interpreter puts word variables first in memory, the word variable defined in the second program would overlay the first two byte variables from the first, and the summation would be of the last eight bytes and two undefined bytes!
__________________
This message was archived from an earlier forum system. Some information may have been left out. Start new discussion in the current forums, and refer back to these threads when necessary.
|