Go Down

Topic: Why use int instead of byte for pin numbers? (Read 26161 times) previous topic - next topic

GrooveFlotilla

Quote
They were using signed integers to store that. It would have taken a semi competent programmer of any seniority, let alone architect, to realize that it takes the same space and processing power to just use an unsigned integer,
Java mentality.
Some people are like Slinkies.

Not really good for anything, but they bring a smile to your face when pushed down the stairs.

INTP

When's the last time you ever saw a perfect product that pleased everybody?

MarkT

yea, I am getting close to the edge of ram in one of my project, changed all my const X's to #defines and freed up almost 2 dozen bytes of ram

Surprising that, since const variables are stored in progmem, not in RAM...

Once it has gone through the compiler there is no difference between
Code: [Select]

const byte X = 4;

and
Code: [Select]

#define X 4

Nope, they are different, as has been proven by experiment with the actual compiler and
the actual compiler optimization settings used in the environment.  There is definitely no
requirement to store const variables in read only memory, its just a possible optimization.
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

Go Up