This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

CPP preprocessor: #define-splitting?


Hi,

I'm developing a gcc-compatible preprocessor for a compiler project. While
doing this, I discovered something strange.

In preprocessor documentation:

    /\
     *
     */ # /*
     */ defi\
     ne FO\
     O 10\
     20


will expand to "#define FOO 1020". It does.

But:

# /*
*/ define TEST "foo"

--> #define TEST "foo"

Replacing the "#" by an "X" will produce with gcc -E:

X
 define TEST "foo"


_BUT_:
#
 define TEST "foo"

--> TEST doen't get defined.

The problem is: Why does it recognize the "#" and "define" splitted by a
multi-line comment as "#define"? Is this the correct behaviour?

Thanks for your help
Florian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]