0

I have two strings in flash memory in an embedded micro like so:

#define HELP_STRING \
"\r\nhelp:\r\n Lists all the registered commands\r\n\Software Version r\n"

#define VERSION " 0.3.2"

I would like to have this:

static const CLI_Command_Definition_t xHelpCommand =
{

    "help",
    FULL_HELP_STRING,
    prvHelpCommand,
    0
};

where FULL_HELP_STRING is the equivalent of this:

#define FULL_HELP_STRING (HELP_STRING + VERSION)

How would achieve this please? Thanks!

DiBosco
  • 838
  • 8
  • 21
  • I did search for this before asking the question, but I wasn't wording the question correctly to find this previous question/answer, sorry. – DiBosco Feb 04 '16 at 11:21
  • You say "in flash memory", but here we're talking about the compiler, not the runtime environment. The strings aren't "in flash" until you actually put them into some value that the compiler emits... which would be your structure initialization. You want to be doing the concatenation in the compiler, where it doesn't matter where the strings finally end up. – Jordan Brown Nov 25 '19 at 23:07

1 Answers1

3

Just drop the +, like this:

#define FULL_HELP_STRING HELP_STRING VERSION
hey hey
  • 190
  • 8