-
Notifications
You must be signed in to change notification settings - Fork 56
Open
Description
A string that begins with inf, regardless of what comes after (except "" and "inity"), will silently succeed :
double d;
char str[] = "Informed"
if (atod(str, &d)) {
std::cout << "This should fail !" << std::endl;
std::cout << d << std::endl;
}
// This should fail !
// infDoes atod do whole string matching ? Is this the intended behavior.
My use case is for decoding primitives not known in advance in a specific order :
{ // bool
bool value;
if (from_chars(substr, &value))
return XmlRpc::XmlRpcValue(value);
}
{ // int
int value;
if (from_chars(substr, &value))
return XmlRpc::XmlRpcValue(value);
}
{ // double
double value;
if (from_chars(substr, &value))
return XmlRpc::XmlRpcValue(value);
}
{ // string
std::string value;
if (from_chars(substr, &value))
return XmlRpc::XmlRpcValue(value);
}Ultimately, is it up to me to check for a inf character is valid ?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels