This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

combining identical string literals



hi all

i'm using the TM320C6x C/C++ compiler and linker v6.1.19 and i have noticed that the linker does not seem to combine identical string literals into one.

for instance, if you have an assertion in a header file that uses __FILE__ to include the file name in the message, and you include this header file in N compilation units, then you'll end up with N copies of that header file's name in the final output. this results in a considerable amount of wasted space.

is there any option you know of to tell the linker to combine identical string literals?

cheers,

sam

  • Samuel Nobs said:
    is there any option you know of to tell the linker to combine identical string literals?

    No.  The compiler reuses string literals within a single source file (and the files it includes), but not across source files.

    Thanks and regards,

    -George