Hey, I was playing with input the other day with my GCC 4.7, and found the following to produce an unexpected HANG when a negative
number was provided at input:
(I validated that the problem occurred with stringstream as well, but did not play with a filestream.)
I considered this to be a serious security issue, and was concerned that it happened at all. I mean, I would have presumed that the standard library code would be able to, at the very least, return a nonsense value and leave cin
in a fail state. But instead the program just hung, and the standard MS "searching for solution" dialogue came up.
And now that I want to play with it some more, I cannot reproduce the error
In (supposedly) unrelated news, I am finally happy that I got Microsoft's compiler installed on my machine! (For years
I couldn't, because my XP system was one of the few that, for reasons MS couldn't (or wouldn't) explain, refused to successfully install .NET 3.5 -- a known bug for some small number of XP systems). In any case, now that I'm running Windows 7 I've got VS happily installed.
I don't know how MinGW does string-to-integer conversions -- if it is with some MS lib then I may have inadvertently updated it with my fresh VS 11 install...
In any case, has anyone else had this issue
? Is this something I should worry about in the FAQ dealing with converting strings to integers? (Remember, I'm being pragmatic with the FAQ, and not idealistic. For example, I'll not claim that <regex> works nicely.)