Hi there! At present I am writing a program in C51 that might be available in different language versions one day. So I place all texts in one file called texts.h. That file looks like [...]
#define OK_STR "ok" #define CRLF_STR "\x0D\x0a" #define MODEM_STR "Modem"
Using a #define affects the output of the preprocessor. As far as the compiler in concerned, it just sees lots of literal strings with no immediately obvious connection between them. While it might theoretically be possible for an optimiser to pick up on the fact that one string is being used several times, I am pretty sure that C51 does not do this. Your best bet is to define constants stored in code memory, it is a little bit more trouble (but not much) and the program memory savings are potentially significant.