Is a C++ preprocessor identical to a C preprocessor?

The C++03 preprocessor is (at least intended to be) similar to the C preprocessor before C99. Although the wording and paragraph numbers are slightly different, the only technical differences I’m aware of between the two are that the C++ preprocessor handles digraphs (two-letter alternative tokens) and universal character names, which are not present in C.

As of C99, the C preprocessor added some new capabilities (e.g., variadic macros) that do not exist in the current version of C++. I don’t remember for sure, but don’t believe that digraphs were added.

I believe C++0x will bring the two in line again (at least that’s the intent). Again, the paragraph numbers and wording won’t be identical, but I believe the intent is that they should work the same (other than retaining the differences mentioned above).

Leave a Comment