Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

See what the preprocessor is doing

Is there anyway to see what you code looks like after the preprocessor has done all the substitutions?

like image 255
Lyndon White Avatar asked Nov 12 '09 01:11

Lyndon White


People also ask

How do I find the preprocessor output?

Preprocessing is a stage where preprocessor directives are expanded or processed before source code is sent to the compiler. The most common example of such directive is #include or #define. A preprocessor output has “. i” extension.

What does ## mean in C preprocessor?

This is called token pasting or token concatenation. The ' ## ' preprocessing operator performs token pasting.

What is preprocessor explain how it works?

In computer science, a preprocessor (or precompiler) is a program that processes its input data to produce output that is used as input to another program. The output is said to be a preprocessed form of the input data, which is often used by some subsequent programs like compilers.

Which command is used to check preprocessed code?

4.3 Preprocessing source files If this file is called 'test. c' the effect of the preprocessor can be seen with the following command line: $ gcc -E test. c # 1 "test.


2 Answers

For gcc just use the -E switch

gcc -E

-E Stop after the preprocessing stage; do not run the compiler proper. The output is in the form of preprocessed source code, which is sent to the standard output.

like image 158
jitter Avatar answered Oct 01 '22 03:10

jitter


That depends on your compiler. With gcc, you would use:

gcc -E source.c
like image 27
caf Avatar answered Oct 01 '22 04:10

caf