-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
YAML octal scalars not converted to ints #1251
Comments
I think you're right. Probably the right behavior is to add the |
According to 1.2 specs, an old format is supposed to be parsed as decimal numbers:
|
Only a minority of YAML users are talking C. The others are completely unprepared for 010 = 8. Upstream YAML was right to correct the specs. |
The 1.2.2 YAML spec indicates octal literals should be formatted as "0o123" which is annoyingly not consistent with what C++ thinks octal strings should look like (0123).
The stringstream extraction currently used expects octals to have a single leading '0', not '0o'. This is used by yaml-cpp:
yaml-cpp/include/yaml-cpp/node/convert.h
Lines 142 to 155 in eaf7205
Which ultimately means "0o123" cannot be converted to an int. "0123" on the other hand can be converted to an int, which is maybe not the desired behavior if strictly adhering to the 1.2 spec.
Note this is true only as of YAML 1.2, version 1.1 specifies octals the opposite way 🙃.
Somewhat related to treatment of booleans: #1198
The text was updated successfully, but these errors were encountered: