This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

string constant in macro

Hello,

In my C code, I have:
#define message
message("Start\n");

When I look at the SRC file, I see:

RSEG ?CO?MAIN
?SC_0:
DB 'S' ,'t' ,'a' ,'r' ,'t' ,00AH,000H

; message("Start\n");

Why does the C51 version 1.32 keep "Start\n" in the output? Does this also happen to newer version?

Thanks,
Anh

Parents
  • Sounds like a very bad idea to me.

    remember, it's the preprocessor that does macro expansion, and it's also the prepropcessor that strips comments...

    Far better to make your macro expansion explicitly & directly conditional (as described in the TRACE example), than rely on the order of macro "side-effects"...

Reply
  • Sounds like a very bad idea to me.

    remember, it's the preprocessor that does macro expansion, and it's also the prepropcessor that strips comments...

    Far better to make your macro expansion explicitly & directly conditional (as described in the TRACE example), than rely on the order of macro "side-effects"...

Children