1

I work with a legacy code and when I include some headers on linux I have to undef appropriate macros, for example:

#pragma push_macro("align")
#undef align

#include <memory>

#pragma pop_macro("align")

I would like to create a macro which expands to the above code and can be used this way:

include_(memory, align)

I can use _Pragma instead of #pragma inside #definebut what about with #undef and #include ? Is it possible to create such macro ?

Irbis
  • 1,432
  • 1
  • 13
  • 39
  • It's not possible. – πάντα ῥεῖ Dec 29 '20 at 11:52
  • 3
    It is not possible with a macro, but you could create your own include file, e.g. `memory_noaligh.h` that contains the 4 lines shown in the question and replace these lines with a single `#include "memory_noalign.h"`. – Bodo Dec 29 '20 at 11:54

0 Answers0