That is because internally it processes the string up to the point where it finds the non valid character (. or ,) and then returns false. The passed variable n contains the value up to that point but is not valid as the function itself returned false. One might expect n to not be touched unless the function can return true but that would not be optimized.
But the function result is false, isn't it?
ReplyDeleteI think its rather the point of the trystrtoxxx functions, strtoint would error - as would val (i think)
ReplyDeleteThat is because internally it processes the string up to the point where it finds the non valid character (. or ,) and then returns false. The passed variable n contains the value up to that point but is not valid as the function itself returned false.
ReplyDeleteOne might expect n to not be touched unless the function can return true but that would not be optimized.