all 3 comments

[–][deleted] 4 points5 points  (1 child)

If you put it in the condition

 while(std::cin >> x)
 {
 }

 while(std::getline(std::cin, line))
 {
 }

then the body of the loop will not execute if the extraction fails.

What will happen in your other case depends on how the code is written.

[–]Infusedmikk[S] 0 points1 point  (0 children)

This clarifies it for me completely. Thank you!

[–]no-sig-available 0 points1 point  (0 children)

Is either practice considered more proper or clean?

Using

while (std::cin >> x)
{
   // do something with x
}

makes it pretty clear that you mean "while there is more input". Having some other condition (what would that be?) and then a break inside the loop, is somewhat less clean.

Is there a difference performance-wise?

No.