I want to use some strings that are stored in the program memory only, so they don't waste any RAM. I've seen two ways of declaring them, namely
// option 1 #define MYTEXT_1 F("somestring") // option 2 const char MYTEXT_2 PROGMEM = "anotherstring";
Which way should I use, or are they completely equivalent?
There are only two differences that I can think of:
If referenced multiple times, option 2 should not lead to any changes. But what about option 1? The compiler should be smart enough to do some redudancy check and put all equivalent F("somestring") into the same memory area, right?
2. Unused references
What if the declared strings are not used at all? Because of its nature as a preprocessor macro option 1 definitley does not consume any space then, but what about the other one? Is the compiler smart enought to remove it from the resulting output (if optimization is enabled)?
Am I right with my assumptions? Are there any other differences?
Thanks in advance!