Блог пользователя SPyofgame

Автор SPyofgame, история, 3 года назад, По-английски

Does anyone know any simple website or tool or vscode-extension that replace all macros directly into the source code ? I tried to search on google/vscode-extension something like antimacro ..., remove macro ..., replace macro ... but find no result. Thanks for helping ^^

  • Проголосовать: нравится
  • +19
  • Проголосовать: не нравится

»
3 года назад, # |
  Проголосовать: нравится +23 Проголосовать: не нравится

Expanding macros is work of the preprocessor, which is already there in the compiler. G++ has a flag -E (expand macros). Use it like this:

g++ -E file.cpp
  • »
    »
    3 года назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    It was helpful, just wondering if I can expand inline function too ^^

    • »
      »
      »
      3 года назад, # ^ |
        Проголосовать: нравится 0 Проголосовать: не нравится

      Inline functions cannot really be expanded as code; think about how you would inline conflicting variable declarations, or return statements. In the compiler they're typically inlined after being translated to the IR.

      • »
        »
        »
        »
        3 года назад, # ^ |
        Rev. 3   Проголосовать: нравится 0 Проголосовать: не нравится

        Thank ecnerwala can I ask one more question ? Is there such vscode-extension or website that expands the macros directly instead of calling terminal to run g++ -E file.cpp each time ?

  • »
    »
    3 года назад, # ^ |
      Проголосовать: нравится +5 Проголосовать: не нравится

    Thanks for sharing. This can actually help during hacking phase.