Some questions about the C ++ preprocessor:

advertisements

A few questions about the C++ preprocessor:

  1. how to make the preprocessor go to a new line into the preprocessoring code?
  2. how to make the preprocessor insert a tab character or multiple spaces into the preprocessoring code?
  3. how to make the preprocessor insert comments into the preprocessoring code?

1) use the backslash, as Tim pointed out

2) I don't think you can

3)

#define COMMENT /##/ this is a comment
#define CPPCOMMENT(c) /##/ c
#define CCOMMENT(c) /##* c *##/

COMMENT
CPPCOMMENT(This is a c++ comment)
CCOMMENT(This is a c comment)

Edit

2 Caveats

1) Doesn't work in all compilers.

2) Don't do this, it's stupid.