mardi 30 juin 2015

Standard output strange behavior

I have an issue using Eclipse cdt and I am facing a strange behavior:

cout << "Hello world" << endl;
aFunction();
// The output here is Hello world
// END

When I take off the endl the output is nothing

cout << "Hello world";
aFunction();
// No output
// END

and when I put the endl later it works fine :

cout << "Hello world";
aFunction();
cout << endl;
// output is Hello world
// END

Now, I can't provide the function code, because it will take me a thousand of lines.

However, I tried this with a function that does nothing void toto(){} and there was not this strange thing .

cout << "Hello world";
toto();
// Gives me Hello world
// END

What I want to know is what can cause this ??

EDIT : The tests with foo are tested alone (no other instructions), In the other tests, I initialize a structure that I give as a parameter to aFunction. The function uses some metaprogramming and there is a lot of code i need to show so you understand it.

Aucun commentaire:

Enregistrer un commentaire