SPyofgame's blog

By SPyofgame, history, 6 years ago, In English

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 ^^

  • Vote: I like it
  • +19
  • Vote: I do not like it

»
6 years ago, hide # |
 
Vote: I like it +23 Vote: I do not like it

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
  • »
    »
    6 years ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

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

    • »
      »
      »
      6 years ago, hide # ^ |
       
      Vote: I like it 0 Vote: I do not like it

      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.

  • »
    »
    6 years ago, hide # ^ |
     
    Vote: I like it +5 Vote: I do not like it

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