Are linemarkers(# 1 "donothing.cpp" 2) in the C preprocessor output used by the compiler to generate the assembler (.s) file?
I expect that they are used to produce compiler errors and debugging information. So I can safely turn these off(with -P) while trying to follow the flow of macros?
I am learning C++, and the C preprocessor. I read in many C++ tutorial that macros are generally difficult to write correctly and can have unexpected results. Here is a sample preprocessor output. The C Preprocessor: Preprocessor Output
$ g++ -Wall -std=c++11 -E donothing.cpp
# 1 "donothing.cpp"
# 1 "<built-in>" 1
# 1 "<built-in>" 3
# 391 "<built-in>" 3
# 1 "<command line>" 1
# 1 "<built-in>" 2
# 1 "donothing.cpp" 2
int main()
{
return 0;
}
$ g++ -Wall -std=c++11 -E donothing.cpp -P
int main()
{
return 0;
}
Is looking at preprocessor output the way to debug compiler errors? How else do c/c++ developers debug their macros (since I expect people work with multiple .cpp files very frequently and there are always compiler errors)?