Normally, I prefer to have setup and loop on top and functions below.
And normally, the system does not require and forward declarations.
But sometimes I need to import/include a huge amount of constants, obviously declared as PROGMEM.
In some cases, they are exported by some tools on a single line without any line breaks between. As soon as the line length exceeds 65536 characters, the error message says: 'some_function' was not declared in this scope.
This even happens when the complete line is marked as a comment.
Of course, there are two solutions to this problem:
- insert a line break in the extra-long line or
- insert forward declarations of your function(s) on top.
At least, users should be warned about this behaviour of the IDE.