Reputation: 8976
While doing a bug report for CUDA's compiler, I ended up finding this strange behavior with gcc's preprocessing step. I currently use gcc 4.8.2.
#include <assert.h>
int main()
{
int a = 1;
assert (a >= 0);
assert (a
>= 0);
}
gcc -E -x c++ -m64 -g -o "test.cpp4.ii" "test.cpp"
# 2 "test.cpp" 2
int main()
{
int a = 1;
((a >= 0) ? static_cast<void> (0) : __assert_fail ("a >= 0", "test.cpp", 6, __PRETTY_FUNCTION__));
((a >= 0) ? static_cast<void> (0) : __assert_fail ("a >= 0",
"test.cpp"
# 7 "test.cpp" 3 4
,
8
# 7 "test.cpp" 3 4
, __PRETTY_FUNCTION__))
;
The multiline assert seems to be processed differently, leading to these # 7 "test.cpp" 3 4
lines. What does that mean exactly?
Apparently, gcc 4.7 gives # 7 "test.cpp"
(without the last 2 numbers).
Upvotes: 4
Views: 1184
Reputation: 180303
It looks like line markers. As you might have noted, there's no trivial relation between line numbers in the original and preprocessed file. # 7
in the preprocessed input indicates that the source of next line was line7 in the original (which was named test.cpp).
3 4
are flags, meaning "macro expansion from system header" and extern "C"
Upvotes: 5