gcc doubt + how errors are handled

M

maadhuu

CRobot bot;
bot.init();
cout << "Flag";
bot.func(LEFT);

If i run it like this Flag is never printed. If i comment out
bot.func, then Flag is printed as expected. how does this work?? i.e.if
there is an error in some code following some piece of code ,in this case
,bot.func(LEFT),the present line which might be immediately before it need
not be printed....is there some kind of pipelining that is used by gcc??
how does it work??
 
V

Victor Bazarov

maadhuu said:
CRobot bot;
bot.init();
cout << "Flag";
bot.func(LEFT);

If i run it like this Flag is never printed.

You're lucky. If I try it, I get compile errors (CRobot is undefined
to begin with).
If i comment out
bot.func, then Flag is printed as expected. how does this work?? i.e.if
there is an error in some code following some piece of code ,in this case
,bot.func(LEFT),the present line which might be immediately before it need
not be printed....is there some kind of pipelining that is used by gcc??
how does it work??

I'm going on a limb here, but it's possible that you're running into
buffering of the I/O. Try

cout << "Flag" << flush;

V
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top