majintao0131 / yaml-cpp

Automatically exported from code.google.com/p/yaml-cpp
MIT License
0 stars 0 forks source link

invalid hexadecimal/octal emitting #134

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
#include <yaml-cpp/yaml.h>

int main()
{
    YAML::Emitter em;
    em << YAML::BeginSeq << YAML::Hex << 165 << YAML::Oct << 63 << YAML::EndSeq;
    std::cout << em.c_str() << std::endl;
}

What is the expected output? What do you see instead?
expected output:
- 0xa5
- 077
actual output:
- a5
- 77
the expected output parses correctly however

What version of the product are you using? On what operating system?
hg tip (405:2d28ec774955)
linux x86_64 gcc 4.6.2

Please provide any additional information below.
untagged nodes are actually application dependent, yaml spec 1.1 uses 0x for 
hexadecimal and 0 as octal prefixes as an example. Yaml spec 1.2 uses 0o prefix 
for octal numbers as an example. For !!int tag, 1.1 specifies 0 as octal 
prefix, 1.2 however doesn't say anything about non-10 bases. So using 0 as an 
octal prefix seems a better choice, as it's more common, and other parsers, 
like ruby's only understand them.

Original issue reported on code.google.com by DirtY.iC...@gmail.com on 16 Nov 2011 at 4:15

GoogleCodeExporter commented 9 years ago
Fixed, r03a978c9320d.

Thanks!

Original comment by jbe...@gmail.com on 13 Jan 2012 at 6:00