microsoft / microsoft/win32metadata
Annotation to when BOOL indicates to call GetLastError
- Dominant language
- C++
- Stars
- 1.5k
- Forks
- 149
- Avg merge
- 5d 16h
- Merged PRs (30d)
- 4
Description
A common pattern is for functions to return a `BOOL` and if `FALSE`, for the caller to check the return value of `GetLastError`. It would be potentially be help for the metadata to annotate such uses such that consumers of the metadata could provide more useful return types of such functions.
For instance, in Rust instead of the following:
```rust
let result: BOOL = SomeMethod();
if !result.as_bool() {
return Err(GetLastError());
}
```
You could have:
```rust
let result: Result<(), WIN32_ERROR> = SomeMethod();
// Users would normally just do:
SomeMethod()?;
```
Contributor guide
Research direction
The issue names no files, tests, or entry points. Start by locating how Win32 metadata represents BOOL returns and GetLastError behavior, then determine how an annotation could expose this relationship to consumers; done means metadata consumers can generate an error-aware return type for these functions.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, rust
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100