Is it possible for C preprocessor macros to contain preprocessor directives?

The Boost Preprocessor (which works for C as well as C++, even though Boost as a whole is a C++ library) library can help with this kind of task. Instead of using an #ifdef within a macro (which isn’t permitted), it helps you include a file multiple times, with different macros defined each time, so … Read more

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. … Read more

How to make preprocessor generate a string for __LINE__ keyword?

You need the double expansion trick: #define S(x) #x #define S_(x) S(x) #define S__LINE__ S_(__LINE__) /* use S__LINE__ instead of __LINE__ */ Addendum, years later: It is a good idea to go a little out of one’s way to avoid operations that may allocate memory in exception-handling paths. Given the above, you should be able … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)