If one enters a negative number with the above code, the fail/bad bits don't seem to be set (i.e. while loop is skipped), and tempNumber is set to the value of std::numeric_limits<unsigned int>::max() plus whatever negative value was entered.
Question: Is this normal behaviour, or am I missing something?
Thanks heaps for your response. That's weird behaviour, don't you think? Could one call that a compiler bug? Maybe it says something about this in the standard, I'll take a look.