Skip to content
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

It is confusing that usage elements are displayed in XML as unadorned hexadecimal #20

Open
mhagger opened this issue Dec 17, 2017 · 3 comments

Comments

@mhagger
Copy link

mhagger commented Dec 17, 2017

I must have stared at

<usage_minimum>01</usage_minimum>
<usage_maximum>12</usage_maximum>
<report_count>12</report_count>

a dozen (decimal; i.e, 0x0c) times before realizing, from looking at the C code equivalent, that it is broken. Does it really make sense for usage elements to be represented in hexadecimal in XML? If so, could they be written as 0x12 or 12h to make it clear to human readers that the values are hexadecimal? Or could there be a comment noting that fact?

For that matter, when reading XML, could numbers be self-describing? I.e., could 0x0c, 0Ch, and 12 all be considered equivalent representations of the same number? (Perhaps also 0b00001100.)

(I realize that it would be tricky to do this in a fully backwards-compatible way.)

@spbnick
Copy link
Member

spbnick commented Dec 17, 2017

It was quite a while a go, but I guess I thought the usage page and usage IDs are hexadecimal in the spec and it would be good to match them, I don't remember what I though about having them unmarked. Perhaps I thought the spec and the schema would be enough. Plus you don't often see usage pages/IDs as numbers.

I don't see a problem making the schema and the code accept the optional 0x prefix or an h suffix, and add it on output, in a new version. I'm not sure accepting several formats would warrant the code complexity. Perhaps just one would be enough, and as a C programmer I would prefer 0x naturally.

@spbnick
Copy link
Member

spbnick commented Dec 17, 2017

OTOH, the specification format uses the h suffix, so it might be a better match after all.

@spbnick
Copy link
Member

spbnick commented Dec 17, 2017

And, yeah, I agree it is confusing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants