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

Improve HRESULT constant literal generation #2857

Merged
merged 11 commits into from
Feb 20, 2024
Merged

Improve HRESULT constant literal generation #2857

merged 11 commits into from
Feb 20, 2024

Conversation

kennykerr
Copy link
Collaborator

@kennykerr kennykerr commented Feb 19, 2024

Just a small quality of life improvement for those of us familiar with HRESULT values. Constants are now generated as follows:

pub const E_INVALIDARG: HRESULT = 0x80070057_u32 as _;

Rather than:

pub const E_INVALIDARG: HRESULT = -2147024809i32;

This is a bit more in line with how they are traditionally represented in C++ and just makes them easier to read and identify.

@kennykerr
Copy link
Collaborator Author

Looks like some new Rust nightly compiler changes are breaking the build.

@tim-weis
Copy link
Contributor

Nice change, makes it much easier to interpret those HRESULT values.

The only suggestion I have is to introduce a separator (_) between the value and type suffix1. I find 0x80070005u32 visually harder to parse than 0x80070005_u32.

Footnotes

  1. As supported by integer literal expressions.

@kennykerr kennykerr reopened this Feb 19, 2024
@kennykerr
Copy link
Collaborator Author

Done, that's indeed more readable.

@kennykerr kennykerr merged commit e83513b into master Feb 20, 2024
65 checks passed
@kennykerr kennykerr deleted the hresult branch February 20, 2024 00:28
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

Successfully merging this pull request may close these issues.

2 participants