Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Online Preprocessor for C++ [closed]

I have:

  1. C++ code with lots of complicated MACROS (#define bla bla ...)
  2. And the usage (instantiation) of those MACROS

I need:

A tool (online for example) that will simply do the instantiation of the MACROS (or the system of macros) and show the resultant code.

Example:

Input:

#define AAA(a,b) if ((a) > (b))

AAA(1, f1(10))

Output:

if ((1) > (f1(10)))
like image 689
Narek Avatar asked Sep 19 '12 13:09

Narek


People also ask

What is preprocessor command in C?

In simple terms, a C Preprocessor is just a text substitution tool and it instructs the compiler to do required pre-processing before the actual compilation. We'll refer to the C Preprocessor as CPP. All preprocessor commands begin with a hash symbol (#).

How does Ifdef work in C?

In the C Programming Language, the #ifdef directive allows for conditional compilation. The preprocessor determines if the provided macro exists before including the subsequent code in the compilation process.

How do I find preprocessed code?

Pass gcc the -E option. This will output preprocessed source code. If your compiler commands already has a parameter like -o something.o you may also want to change it to -o something.

What is #ifndef C?

The #ifndef directive checks whether a macro is not defined. If the identifier specified is not defined as a macro, the lines of code immediately follow the condition are passed on to the compiler.


1 Answers

The gcc option would be -E and then your filename.

With the MSVC cl.exe the solution is also /E.

like image 195
Marcus Riemer Avatar answered Oct 15 '22 13:10

Marcus Riemer