I have code with a large switch statement. All the code blocks are small but there are many of them:
switch(a) {
case 0: doSomething(); break;
case 1: doSomethingElse(); break;
...
case 20: doSomethingBetter(); break;
default: doSomethingUnknown();
}
When I added an extra case statement I got this compiler error:
relocation truncated to fit: R_AVR_7_PCREL against `no symbol'
Googling that it seems to do with the generated assembler not being able to create a jump statement. At least this problem gets caught at compile time. But it's starting to make me a little nervous - I come from a high level programming background (app development for Windows), and now this (along with another post about stack issues) is making me remember that I'm programming on a __micro__controller. But with a high level set of libraries and a "high level mindset".
Any words of wisdom as to how to find out more about these sorts of limits? I want to keep using the Arduino libraries and I want to continue to write "high level" code (for all the usual productivity reasons). If I knew more about the limits then I could (maybe!) design and code appropriately.
Any insight or advice greatly received!
Thanks.