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,
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 betweenCode: [Select]const byte X = 4;and Code: [Select]#define X 4
const byte X = 4;
#define X 4
Pin numbers: How stupid is that? What's wrong with "PORTB, BIT 7"?
Nope, they are different, as has been proven by experiment with the actual compiler andthe actual compiler optimization settings used in the environment. There is definitely norequirement to store const variables in read only memory, its just a possible optimization.
static constexpr byte x = 4;
However, I found (incidentally, when I was debugging something unrelated and noticed it in the generated assembly code) that in some instances it generated larger code than #define statements.