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 NTSTATUS constant literal generation #2860

Merged
merged 1 commit into from
Feb 20, 2024
Merged

Improve NTSTATUS constant literal generation #2860

merged 1 commit into from
Feb 20, 2024

Conversation

kennykerr
Copy link
Collaborator

Much like #2857, NTSTATUS uses the sign bit for severity just like HRESULT does and are traditionally represented in C++ as hex values. Constants are now generated as follows to improve readability and identification:

pub const STATUS_NOT_FOUND: NTSTATUS = 0xC0000225_u32 as _;

Rather than:

pub const STATUS_NOT_FOUND: NTSTATUS = -1073741275i32;

@tim-weis
Copy link
Contributor

Nice, much more comprehensible.

A welcome update, though I'm growing a bit weary of the as _ shorthand. It's easy for a compiler to substitute the _, though a lot harder for a human. Can _ be exchanged for the concrete type (or am I just being overly pedantic here)?

@kennykerr
Copy link
Collaborator Author

Normally, I'd be explicit but these are always directly assigning/initializing an explicit type so it seems overly redundant.

@kennykerr kennykerr merged commit 6682202 into master Feb 20, 2024
65 checks passed
@kennykerr kennykerr deleted the ntstatus branch February 20, 2024 17:54
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.

3 participants