Hi, I used below code and tried to debug in 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 the debugger screen shot.
#line 100 tells compiler to go to line 100 to get its next line. As 100th line doesn't exist, it goes outside the main function as shown in the screenshot. If i try to debug code with F10, control never comes back to main function. It keeps on showing the pointer outside the main function even though it is executing main().
If i give other file name in place of test.cpp, pointer goes to that file, but it doesn't come back to test.cpp
Any idea why debugger is behaving like this ?