Re: Programming@School sucks
On Sep 20, 5:45 pm, Andreas <AndreasSand...@gmx.net> wrote:
On 19 Sep., 12:01, James Kanze <james.ka...@gmail.com> wrote:
On Sep 19, 6:40 am, Juha Nieminen <nos...@thanks.invalid> wrote:
It's a system specific work-around for a design error in the
Microsoft debugger.
What design error? When a console program is started, a new console
window is opened. When it stops the window is closed. The debugger
doesn't affect the program by default.
Running a program under the debugger, and not capturing its
output, is simply stupid. No one else does it. It can only be
considered a design error.
The cited line tries to keep the windows open by preventing an exit
from the main function. The call to cmd.exe with the "PAUSE" argument
is clumsy, but not a workaround for the debugger. If you need to stop
the program before if exits (and the windows is closed), you can add a
breakpoint on the closing bracket of main.
It has nothing to do with stopping the program. If the
debugger starts a program, it captures its output, either
directly or indirectly.
[...]
When you run the console program in an open console window, it
doesn't need a new window. In that case the output goes to the
current window. I think this works as expected, even if you
would expect. Dont' you?
Yes. So why doesn't the debugger do it that way, instead of
what it does? If the shell can do it, so can the debugger.
--
James Kanze