Strange debugger behavior when using the #line control

I used the code below and tried to debug Visual Studio 2008 by pressing F10.

//test.cpp
#include<iostream>
using namespace std;

int main(void)
{
#line 100 "test.cpp"
   cout<<"Inside main()"<<endl;
   return 0;
}

Below is a screenshot of the debugger.

alt text

#line 100 tells the compiler to go to line 100 to get the next line. Since the 100th line does not exist, it goes beyond the scope of the main function, as shown in the screenshot. If I try to debug code using F10, control never returns to the main function. It continues to show the pointer outside the main function, even if it executes main ().

If I give a different file name instead of test.cpp, the pointer goes to that file, but it does not return to test.cpp

Any idea why the debugger behaves as follows?

+5
2

. , . , , , . ( ) .

, . , , . , , . .

+8

. , . docs - , ?

# , .

, " " . , , - .

+1

All Articles