I'm on an embedded system (for the first time) and have a whopping 512 bytes of memory. I'm constantly bumping up against that barrier, and I'm looking to save on each and every byte possible. As such, the following question:
In the SDK, there's a function, prototyped:
void foo(int val);
As such, my main looked like:
void main() {
int myVal = 0;
// do stuff to compute myVal
foo(myVal);
}
myVal, however, will never have a value more than ~100. Will I be saving any memory at all by doing this instead?
void main() {
short int myVal = 0;
// do stuff to compute myVal
foo(myVal);
}
edit: On this architecture, ints are 4-bytes, shorts are 2-bytes. I'm mostly unsure of whether using a local short (or char, or whatever) will save space since it has to up-cast to meet the foo(int) prototype.